All problems

UrbanHop's Best-Rated Driver

easySQLSorting

UrbanHop, a city ride-hailing app, runs a "meet the community" spotlight in the app each month, and this month's slot goes to the highest-rated driver. The design team needs the driver's name and the rating to print beside the photo.

Ratings sit on the driver row and are averages the app has already worked out from rider feedback, so nothing has to be recalculated — the only question is which of the four rows is on top, and getting the name to travel with the figure.

drivers — one row per driver. rating is their average rider score out of 5.

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

The table already exists in the database — there is nothing to create or load.

Task: Write a query returning a single row with two columns, name and rating, for the driver with the highest rating. Exactly one row comes back.

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

name rating
Vera Lindqvist 4.7

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…