Practice · History · Medium
Return only the countries that hold more than one obelisk, as current_country and obelisks, most first.
Runs in your browser. No signup needed.
obelisks(current_country). Filter groups with HAVING, not WHERE.
SELECT current_country, COUNT(*) AS obelisks
FROM obelisks
GROUP BY current_country
HAVING ...;
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.
WHERE filters rows before grouping; HAVING filters the groups afterwards — which is why counting conditions belong in HAVING.