|
The SQL DISTINCT command is used along with the SELECT statement. It retrieves only unique data entries depending on the column list you have specified after it. Here is an example.
Table Name ‘Users’
|
U_Id
|
FirstName
|
LastName
|
City
|
|
1
|
Ajay
|
senha
|
New York
|
|
2
|
Vinda
|
kapoor
|
Los Angeles
|
|
3
|
Qasim
|
bilal
|
New York
|
Statement:
SELECT DISTINCT City
FROM Users
Result:
|
City
|
|
New York
|
|
Los Angeles
|
Essentially what the DISTINCT keyword does is removing the duplicates from the result set returned by your SELECT SQL statement. |