Learn SQL Lesson

Removing Duplicates with DISTINCT

`DISTINCT` removes duplicate rows from a result set.

If you only want the unique regions in the `sales` table, you can write:

SELECT DISTINCT region
FROM sales

`DISTINCT` works on the full combination of selected columns. That means:

SELECT DISTINCT salesperson, region
FROM sales

returns unique salesperson-region pairs, not just unique salespeople.

Use `DISTINCT` when you want a clean list of unique values.

Practice challenge

Return the unique regions from the sales table, ordered alphabetically.

Open interactive editor