SQL Select Distinct
Return only distinct (different) values.
SQL SELECT DISTINCT Statement
The SELECT DISTINCT statement is used to return only distinct (different) values.
Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.
Syntax
SELECT DISTINCT column1, column2, ...
FROM table_name;
SELECT DISTINCT Example
The following SQL statement selects only the DISTINCT values from the "Country" column in the "Customers" table:
SELECT DISTINCT Country FROM Customers;
The following SQL statement counts and returns the number of different (distinct) countries in the "Customers" table:
SELECT COUNT(DISTINCT Country) FROM Customers;