DISTINCT
DISTINCT removes duplicate rows from a query's results, so each unique value or combination appears only once. It goes right after SELECT.
SQL
Use it when a column has repeated values but you only care about the unique ones — for instance, listing every distinct country your customers come from.
When you list multiple columns, DISTINCT considers the whole combination unique, not each column individually.
Syntax
SELECT DISTINCT column FROM table_name;Examples
SQL
SELECT DISTINCT country FROM users;Output:
country
-------
USA
UK
Canada