Practice · Demographics · Medium
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.
SELECT city FROM universities UNION SELECT name FROM governorates. UNION stacks two result sets and removes duplicates.
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.
UNION removes duplicates; UNION ALL keeps them (and is faster). Pick based on whether duplicates matter. (SQLite docs)