AnalystPath

Best Recorded Time per Runner

SQLEasyJunior level~15 min

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.

race_log
athlete_idgiven_namefamily_namefinish_secondsclub_code
1MiraOkonjo4120C90
1MiraOkonjo4500C90
2BaoLiang3890C71

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

Related SQL questions