SQL DISTINCT KEYWORD -The Coding Shala
Home >> Learn SQL >> SQL DISTINCT Keyword
The following query without 'DISTINCT' keyword will fetch 'Address' from the table -
If we use 'DISTINCT' keyword then it will give only unique values of address -
Other Posts You May Like
Please leave a comment below if you like this post or found some error, it will help me to improve my content.
SQL DISTINCT KEYWORD
SELECT DISTINCT column1, column2, ... FROM table_name;
SQL DISTINCT KEYWORD EXAMPLE
The following table Persons will be used for the examples -
PersonID LastName FirstName Address City 1 Saini Akshay A-101 Pune 2 last first A-101 Pune 3 Smith Jhon B-02 Mum
The following query without 'DISTINCT' keyword will fetch 'Address' from the table -
SQL >> select Address from Persons; OUTPUT >> Address A-101 A-101 B-02
If we use 'DISTINCT' keyword then it will give only unique values of address -
SQL >> select distinct Address from Persons; OUTPUT >> Address A-101 B-02
Other Posts You May Like
- SQL Order BY
- SQL COUNT() Function
- SQL AVG() Function
- SQL SUM() Function
- SQL MIn() and Max() Function
Prev<< SQL CONCAT Function NEXT >>SQL GROUP BY
Comments
Post a Comment