# DUCK OLYMPICS PHOTO FINISH

WEEKLY QUACK CHALLENGE! · challenge 3 · hard · 5 guesses

> Track Judge Pintail squints at the photo-finish screen. "Everybody watched the leader at checkpoint three — but the real story is who flew past them at the tape! Some duck went from nearly last to first in the final stretch. That's the comeback of the century, Duckbert. Don't look at the sprint — this is marathon business. Find the duck who improved their rank the most from the second-to-last checkpoint all the way to the finish!"

## Task

Among marathon runners only, rank the field by time at each checkpoint (fastest is rank 1). The comeback of the day belongs to the runner who climbs the most ranks between the last checkpoint before the finish and the finish itself. Return their name; on a tie, the alphabetically first. You will be working with the `splits`, `athletes`, and `races` tables.

## Tables

### `splits` (38 rows)

| column | type |
| --- | --- |
| race_id | INTEGER |
| athlete_id | INTEGER |
| checkpoint | INTEGER |
| time | DECIMAL(8,2) |

### `athletes` (13 rows)

| column | type |
| --- | --- |
| athlete_id | INTEGER |
| name | VARCHAR |
| country | VARCHAR |

### `races` (2 rows)

| column | type |
| --- | --- |
| race_id | INTEGER |
| event | VARCHAR |

## Data

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

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

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

Play it in the browser: https://dbquacks.com/challenges/weekly/3

## Answer

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