SQL UNIQUE keyword

The UNIQUE keyword is used to retrieve the unique records by eliminating the all duplicate records.

Syntax:

SELECT UNIQUE column1, column2,…..columnN FROM tableName WHERE [condition]
UNIQUE and DISTINCT statements are same and will give the same result sets.

Example:

SELECT UNIQUE EMP_NAME FROM EMPLOYEE;

Output:

EMP_NAME
Nidhi
Parbhjot
Parmender

No comments: