# Forward Momentum Scout

THE GREAT DUCK MIGRATION! · challenge 17 · hard

> Navigator Neptune swoops in with weather forecasting equipment and performance projection charts. "Migration success requires predicting future performance! Using each duck's competition history, find who shows the strongest FORWARD momentum - comparing each attempt to their NEXT attempt. The duck with the best next-attempt projection will scout tomorrow's dangers!"

## Task

Return the SSN of the duck with the largest positive performance gain when comparing consecutive attempts within the same sport (ordered by competition_date). If multiple ducks tie for the largest gain, return the one with the smallest SSN. You will be working with `duck_athletes` and `performance_records` tables. Only consider positive improvements (where the next score is higher than the current score).

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

## Answer

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