SQL Challenges · THE GREAT DUCK MIGRATION!
The Winter Edge
Difficulty: medium
Dr. Stork bursts into the war room clutching a frost-rimmed calendar and shivering. Duckbert, the early-spring mountain passes are an icebox - ice on the ponds, freezing headwinds, and predators hungry after winter! I dont just need ducks who showed up in the cold; I need the rare athletes who get BETTER when the frost bites. Compare each athletes scores in the first quarter - January, February, and March - against everything they posted the rest of the year. The ducks whose winter scoring aver…
Your task
Return the sum of SSNs for all ducks whose average score in first-quarter competitions (held in January, February, or March) is strictly higher than their average score across all their other competitions held during the rest of the year (April through December). Only include ducks who have at least one first-quarter competition and at least one competition outside the first quarter. You will be working with the `duck_athletes` and `performance_records` tables.