Blog · Guide

SQL DISTINCT Explained: Unique Values Only

DISTINCT removes duplicate rows from the result — perfect for “which cities appear in the table?”

customers first_name last_name city result first_name · city
SELECT chooses which columns appear in the result.

Unique list of values

SELECT DISTINCT city
FROM customers;

Each city once. If you need counts per city, that’s GROUP BY + COUNT — different tool, related idea.

Try it yourself

The fastest way to lock this in is a short drill on the same Northstar Market tables.

Practice DISTINCT

Related guides