Best Recorded Time per Runner
Problem
Table: `race_log`
| Column Name | Type |
|---|---|
| athlete_id | int |
| given_name | varchar |
| family_name | varchar |
| finish_seconds | int |
| club_code | varchar |
This table may contain several rows for the same athlete, one per race they entered. A higher `finish_seconds` value means a stronger result on this leaderboard (it is a cumulative points-per-second score, not a clock time).
Report, for every athlete, their best (highest) `finish_seconds` value. Output the athlete's id, given name, family name, that best score aliased as `finish_seconds`, and their club code. Order the result by `athlete_id`.
Tables
Example rows — the live problem includes the full dataset.
| athlete_id | given_name | family_name | finish_seconds | club_code |
|---|---|---|---|---|
| 1 | Mira | Okonjo | 4120 | C90 |
| 1 | Mira | Okonjo | 4500 | C90 |
| 2 | Bao | Liang | 3890 | C71 |
Expected output
Your answer should return 3 rows with the columns athlete_id, given_name, family_name, finish_seconds, club_code.
Starter code (SQL)
SELECT *
FROM race_log;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock