Practice · Demographics · Hard

Governorates without a university (EXCEPT)

Return the governorate names that are NOT a university city in our data, alphabetically.

Runs in your browser. No signup needed.

What you are given

SELECT name FROM governorates EXCEPT SELECT city FROM universities. EXCEPT subtracts the second set from the first.

Starting point

SELECT name FROM governorates
EXCEPT
SELECT city FROM universities
ORDER BY name;

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

EXCEPT (called MINUS in some databases) answers “in A but not in B” — a clean alternative to an anti-join for single columns. (SQLite docs)

More Demographics challenges

Open it in the playground →