Practice · History · Medium
Return the name and reign length (as years_reigned) of every pharaoh who reigned MORE than 30 years, longest first.
Runs in your browser. No signup needed.
Use pharaohs. reign_end − reign_start gives the length.
SELECT name, (reign_end - reign_start) AS years_reigned
FROM pharaohs
WHERE ...
ORDER BY ...;
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.
Ramesses II reigned ~66 years and outlived many of his own heirs; the son who finally succeeded him, Merneptah, was already elderly. (Britannica)