Practice · History · Medium

Pharaohs who built something (IN)

Return the names of pharaohs who appear as the builder of at least one monument, alphabetically.

Runs in your browser. No signup needed.

What you are given

pharaohs WHERE name IN (SELECT builder FROM monuments). A subquery can feed an IN list.

Starting point

SELECT name
FROM pharaohs
WHERE name IN (SELECT builder FROM monuments)
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

IN (SELECT …) is a set-membership test — “is this name anywhere in that list?”. (SQLite docs)

More History challenges

Open it in the playground →