[SQL] “Largest Olympics” – ESPN

SQL Largest Olympics Solution from StrataScratch and ESPN

Photo from Alex Smith on Unsplash

 

The olympic games, this celebration of human competition, transcends borders, cultures and generations. Thorughout the history these Games have inspired us to reach beyond our limits and to unite in the spirit of competition and friendship. Athletes from around the world showcase their dedication and skill, turning the world’s spotlight towards the pursuit of excellence.

But enough with the grandiose Talk, we want to solve an interview question!
You find the puzzle here.

And this is the solution for it:

SELECT games, COUNT(DISTINCT id) AS "athletes_count"
FROM olympics_athletes_events
GROUP BY games
ORDER BY athletes_count DESC
LIMIT 1

 

Here you find a complete walkthrough of the solution:

 

Related Images: