Practice · History · Medium

Height of stone per country

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.

What you are given

obelisks(current_country, height_m). Use SUM, AVG and ROUND.

Starting point

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.

Did you know

Averages hide the story here: a country can hold many small fragments or one colossal shaft, so total and average rank countries differently.

More History challenges

Open it in the playground →