Practice · History · Hard

What share left Egypt

In one row, return the total number of obelisks as total, how many stand outside Egypt as abroad, and the percentage abroad as pct_abroad rounded to 1 decimal.

Runs in your browser. No signup needed.

What you are given

obelisks(current_country). Use COUNT(*) with a conditional SUM(CASE WHEN ... THEN 1 ELSE 0 END), and multiply by 100.0 to force real division.

Starting point

SELECT COUNT(*) AS total,
       SUM(CASE WHEN ... THEN 1 ELSE 0 END) AS abroad,
       ROUND(...) AS pct_abroad
FROM obelisks;

The reference solution is checked automatically when you run your query on the practice page — results are compared row by row.

Did you know

Integer division is the classic trap: 18/33 is 0 in SQL until you multiply by 100.0 and make it a real number.

More History challenges

Open it in the playground →