Practice · Demographics · Medium

All the places (UNION)

Return one combined, de-duplicated, alphabetical list of place names: every university city and every governorate name, in a single column named place.

Runs in your browser. No signup needed.

What you are given

SELECT city FROM universities UNION SELECT name FROM governorates. UNION stacks two result sets and removes duplicates.

Starting point

SELECT city AS place FROM universities
UNION
SELECT name FROM governorates
ORDER BY place;

The reference solution is checked automatically when you run your query on the practice page — results are compared row by row, and order matters for this one.

Did you know

UNION removes duplicates; UNION ALL keeps them (and is faster). Pick based on whether duplicates matter. (SQLite docs)

More Demographics challenges

Open it in the playground →