SQL DISTINCT


The distinct keyword is used with Select statement to retrieve unique values from the table. Distinct removes all the duplicate records while retrieving from database.

Syntax

SELECT DISTINCT column_name FROM table_name;

Example

eidnamesalary
11Ashwani2000
12Sachin3000
13Deepak20000
14Soun20000
15Sanjay3000
SELECT DISTINCT salary FROM emp

The query will return only the unique salary from Emp table

Output
salary
2000
3000
20000

Share this article on