SQL Select Unique

SQL SELECT UNIQUE is used to select unique data entries in a table.

It is an old syntax which was used in oracle but later ANSI changed the keyword to DISTINCT officially.

The syntax of SELECT UNIQUE statement is

SELECT UNIQUE column_name
FROM table_name;

 

Example:

Let us take a table Student where the cities of two students are same.

StudentID Student_Name Address City
1 Nithin Bank Street Hyderabad
2 Bharath White Field Bangalore
3 Goutham Avenue colony Chennai

 

SELECT UNIQUE City FROM Student;

 

Now only the unique city data will be displayed

Hyderabad
Bangalore