Distinct

Description: The DISTINCT clause allows you to remove duplicates from the result set. The DISTINCT clause can only be used with select statements.

The syntax FOR the DISTINCT clause IS:
 
SELECT DISTINCT columns
FROM tables
WHERE predicates;
 
Let's take a look at a very simple w3mentor.
 
SELECT DISTINCT city
FROM suppliers;
 
This SQL statement would return all unique cities from the suppliers table.

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.