Practice · Demographics · Medium
Return name and population density (people per km²) as ROUND(population_millions × 1000000 / area_km2, 0) aliased as density, densest first. Note how desert governorates rank low.
Runs in your browser. No signup needed.
governorates(name, population_millions, area_km2). Density = people ÷ area.
SELECT name,
ROUND(population_millions * 1000000 / area_km2, 0) AS density
FROM governorates
ORDER BY density DESC;
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.
Qalyubia and Cairo are among the densest places on Earth, while vast desert governorates like Minya look sparse on paper — density reveals what a raw population count hides.