All problems

UrbanHop's Runner-Up Driver

mediumSQLSubqueriesRanking

The "Driver of the Month" shoutout also wants a runner-up mention.

drivers

id name city rating
1 Sam Rios Austin 4.9
2 Priya Desai Denver 4.6
3 Oscar Lund Seattle 4.8
4 Nina Cole Austin 4.2

Task: Line the four drivers up from the highest rating down to the lowest and write a query that returns the name and rating of the one standing second in that lineup — the second row, not the second-best rating value. The two readings differ only when the top rating is shared: if two drivers were both on 4.9, the second row is one of those two, a driver who is really tied for first, and the next rating below 4.9 is not the answer. Return exactly one row. No two drivers share a rating in this data.

Example output — shape only, on an invented driver and rating.

name rating
Vera Lindqvist 4.4

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…