What is DISTINCT keyword used for in SQL?
Explanation
DISTINCT keyword is used together with SELECT clause to eliminate all duplicate records in the result set and return only unique records.
Basic syntax of DISTINCT keyword
SELECT DISTINCT column1, column2,.....columnN 
FROM table_name
[WHERE conditions]
Returned records will be considered different if they differ in at least one column.
For example:

SELECT DISTINCT NAME, AGE
FROM USER
may return: Ann 21
Ann 28
John 31
John 23

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes