Practice · Sports · Medium

The Cairo duopoly’s share

Compute what percentage of ALL league titles in the table are held by Al Ahly and Zamalek combined. Return one column named cairo_pct, rounded to one decimal.

Runs in your browser. No signup needed.

What you are given

football_titles(club, league_titles). Divide the two Cairo clubs’ titles by the SUM of all titles × 100. Cast to REAL (× 100.0) so you don’t get integer division.

Starting point

SELECT ROUND(
  SUM(CASE WHEN club IN (...) THEN league_titles ELSE 0 END) * 100.0
  / SUM(league_titles), 1) AS cairo_pct
FROM football_titles;

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

Did you know

Ahly and Zamalek — the Cairo Derby — between them hold the overwhelming majority of Egyptian league titles, one of the most lopsided duopolies in world football. (Wikipedia)

More Sports challenges

Open it in the playground →