SQLeasyRanking~12m
A ride-sharing company wants to rank drivers by their average trip rating within...
Problem
A ride-sharing company wants to rank drivers by their average trip rating within each city for the month of January 2024. Return the driver ID, driver name, city, average rating (rounded to 2 decimal places), and their rank within the city. Drivers with the same average rating should receive the same rank, and the next rank should skip accordingly (standard competition ranking). Order results by city, then by rank ascending.
Examples
Example 1
Example 2
Constraints
- ›Return columns: driver_id, driver_name, city, avg_rating, rank
- ›Average rating rounded to 2 decimal places
- ›Use RANK() for standard competition ranking
- ›Filter for January 2024 trips only
- ›Order by city, then rank ascending
Reference solution
Reference solution available after you attempt the question.
Ready to solve it?
Start a session on Mockbit #53. Write your SQL, run it against real data, and get graded on correctness, efficiency, query structure, and business understanding.
Related SQL questions
- #41You're analyzing user engagement for a social media platformeasy
- #43A regional bank wants to analyze account activity by branch locationeasy
- #44A medical clinic wants to identify patients who have been prescribed medications...easy
- #42A video streaming platform tracks user viewing sessionshard
- #45A mobile gaming company wants to identify the top 3 most active players for each...easy
← Back homemockbit.io/q/53