SQL Challenges · THE GREAT DUCK MIGRATION!

Migration Discipline Order

Difficulty: hard

Navigator Neptune spreads detailed training-progression charts across the planning table, each athletes journey mapped from debut to mastery. Duckbert, the order in which a duck masters the four disciplines reveals their migration character! Some tackle swimming first - natural waterfowl, drawn to the river. Others build flying skills early, born scouts hungry for the sky. For our complete athletes - those whove conquered all four disciplines - I need the instinctive swimmers, the ducks whose v…

Your task

Return the sum of SSNs for all ducks who have competed in all 4 sports (swimming, running, diving, and flying_speed) and whose first-ever competition was in swimming. For each duck, determine the chronological order of their first competition in each of the four sports. If a duck first competed in two sports on the same date, order those sports alphabetically. You will be working with the `duck_athletes` and `performance_records` tables.

Tables

performance_records (800 rows)

columntype
duck_idBIGINT
sportVARCHAR
scoreDOUBLE
competition_dateDATE

duck_athletes (50 rows)

columntype
idBIGINT
ssnBIGINT
nameVARCHAR
ageBIGINT
hometownVARCHAR

Database: https://dbquacks.com/data/databases/athletic_champions.duckdb

This page as markdown: https://dbquacks.com/challenges/athletic/37.md

Play this challenge →