SQL Distinct
Advertisements
SQL Distinct
Select Distinct statement is used to retrieve only distinct or unique data. Select Distinct command is used with Select keyword.
Note: SQL Select Unique and SQL Select Distinct statements both are same.
Syntax
SELECT DISTINCT column_name, column_name FROM table_name;
Employee table
emp_id | name | salary |
---|---|---|
101 | Amit | 24000 |
102 | Rahul | 34000 |
103 | Hitesh | 24000 |
104 | Gaurav | 26000 |
105 | Hitesh | 35000 |
Example
SELECT DISTINCT name FROM Employee;
Result after Execute above query.
name |
---|
Amit |
Rahul |
Gaurav |
Hitesh |
Google Advertisment