# Migration Discipline Order

THE GREAT DUCK MIGRATION! · challenge 37 · hard

> Navigator Neptune spreads detailed training-progression charts across the planning table, each athlete's 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 who've conquered all four disciplines - I need the instinctive swimmers, the ducks whose very first competition was in swimming. Find these natural waterfowl so we can deploy them to lead our aquatic formations through the flooded valleys and treacherous river crossings ahead!"

## 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)

| column | type |
| --- | --- |
| duck_id | BIGINT |
| sport | VARCHAR |
| score | DOUBLE |
| competition_date | DATE |

### `duck_athletes` (50 rows)

| column | type |
| --- | --- |
| id | BIGINT |
| ssn | BIGINT |
| name | VARCHAR |
| age | BIGINT |
| hometown | VARCHAR |

## Data

The tables live in a DuckDB database: https://dbquacks.com/data/databases/athletic_champions.duckdb

To query it outside the browser, attach it read-only:

```sql
ATTACH 'https://dbquacks.com/data/databases/athletic_champions.duckdb' AS db (READ_ONLY);
USE db;
```

Play it in the browser: https://dbquacks.com/challenges/athletic/37

## Answer

The expected answer is not published. Submit on the page to have it checked.
