SQL Unique
Select Unique statement is used to retrieve only unique data. Select Distinct command is used with Select keyword.
Note: SQL Select Unique and SQL Select Distinct statements both are same.
Example
SELECT UNIQUE 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 UNIQUE name FROM Employee;
Result after Execute above query.
| name |
|---|
| Amit |
| Rahul |
| Gaurav |
| Hitesh |
Comments
Post a Comment