SQL Challenges · THE GREAT DUCK MIGRATION!
The Steady Medalists
Difficulty: medium
Scout Samantha unrolls a thick sheaf of reliability dossiers across the war table, tracing each athletes steadiest results. Duckbert, peak scores make headlines, but migration survival is won by consistency! A duck who bombs one week and soars the next is a liability over 3,000 miles - I need athletes whose TYPICAL performance is elite, not just their lucky day. The median score captures the real story: half their competitions above, half below. Find the ducks whose median score across all thei…
Your task
Return the sum of SSNs for all ducks whose median score across all their competitions is 85 or higher. The median is the middle value when all of a duck's competition scores are ordered from lowest to highest; when a duck has an even number of competitions, take the median as the average of the two middle scores. Only include ducks who have at least one competition. You will be working with the `duck_athletes` and `performance_records` tables.