# The Steady Medalists

THE GREAT DUCK MIGRATION! · challenge 38 · medium

> Scout Samantha unrolls a thick sheaf of reliability dossiers across the war table, tracing each athlete's 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 their competitions is 85 or higher - these steady medalists deliver excellence on their worst day. Sum their identification codes for the dependable-core roster!"

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

## 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/38

## Answer

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