SQLite SELECT DISTINCT Statement
The SELECT DISTINCT Statement
SELECT DISTINCT returns only the different values. Values that appear more than once are shown only once.
This example lists each country of the customers once:
Without DISTINCT
Without DISTINCT, you get the country of every customer, with many duplicates:
Count the Different Values
Use COUNT(DISTINCT ...) to count the different countries:
DISTINCT on More Than One Column
With more than one column, DISTINCT removes the rows where all the selected columns are the same: