Distinct clause with Select Command
By S.Qasim
Published: 14 May 2013
Select Command clauses in SQL
Distinct clause with Select Command
Distinct clause with select command display the Unique values of the specified column from SQL database table. Distinct means different, so when we use distinct keyword with an column name in Select command it means its display the non identical record form that column.
For example if we have a table "paid-Info" with following record:
|
Member_ID |
Paid Amount |
|
101 |
500 |
|
102 |
300 |
|
103 |
450 |
|
104 |
200 |
|
101 |
500 |
|
102 |
600 |
|
102 |
400 |
|
104 |
500 |
In this above table different user paid us some amount, but if we want to know how many user paid us then we use Distinct keyword with select command as below:
SELECT DISTINCT Member_ID FROM Paid-Info;
where
Memebr_ID is column name
Paid_Info is table name
Above command Display the following records:
|
Member_ID |
|
101 |
|
102 |
|
103 |
|
104 |