The Basics · SELECT DISTINCT
6. Countries with active customers
Concept: SELECT DISTINCTshow
SELECT DISTINCT removes duplicate rows from the result, so each value comes back once. It applies to the whole row: SELECT DISTINCT a, b keeps one row per unique (a, b) pair, not per a.
Example (different data):
SELECT DISTINCT city FROM stores WHERE is_open = true ORDER BY city;
Your task
The localization team needs the list of countries where we still have active customers, to decide which languages to support.
Return each country that has at least one active customer, once, as a single column country, sorted alphabetically.
Solution unlocks after 3 more tries
Starting Postgres in your browser…
query.sql
Output
Write a query and press Run Query (Ctrl/⌘ + Enter).