Practice · History · Medium
For each country return current_country, the total height as total_m and the average as avg_m, both rounded to 2 decimals, ordered by total_m descending.
Runs in your browser. No signup needed.
obelisks(current_country, height_m). Use SUM, AVG and ROUND.
SELECT current_country,
ROUND(SUM(height_m), 2) AS total_m,
ROUND(AVG(height_m), 2) AS avg_m
FROM obelisks
GROUP 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.
Averages hide the story here: a country can hold many small fragments or one colossal shaft, so total and average rank countries differently.