# The Winter Edge

THE GREAT DUCK MIGRATION! · challenge 34 · 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 don't just need ducks who showed up in the cold; I need the rare athletes who get BETTER when the frost bites. Compare each athlete's scores in the first quarter - January, February, and March - against everything they posted the rest of the year. The ducks whose winter scoring average beats their warm-season average are cold-forged: they peak exactly when our migration needs them most. Sum their identification codes so we can assemble the frostbite vanguard!"

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

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

## Answer

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