What does DISTINCT do?

SQL SELECT, filtering and sorting · Freshers

Model answer

It removes duplicate rows from the result: SELECT DISTINCT city FROM customers. It applies to the whole selected row, not one column. DISTINCT can be slow on big results, and sometimes GROUP BY or a better query does the job.

Learn this topic

SELECT, FROM and WHERE: Your First Queries in the course SQL for Beginners: Learn Databases Step by Step.

Sign in to add your own answer.

More questions