Driver Rating Check

ASKED IN INTERVIEW
2pts
Uber

Problem Statement

Uber safety and quality teams monitor driver ratings to ensure a premium experience. They need to identify drivers who might need additional training or warnings because their average rating from trips in the last 7 days has fallen below 4.0.

Write an SQL query to find these drivers.

Rules:

  • Consider only trips with a rating provided in the last 7 days (Reference Date: 2026-02-11).
  • The average rating must be strictly less than 4.0.
  • Output columns: driver_id, avg_rating.
  • Sort the results by avg_rating in ascending order.

Table Schema:

  • Trips: trip_id, driver_id, user_id, rating (1-5), trip_completed_at.
Tests your understanding of
Basic SQL, Aggregation, DateTime and Filtering

Input Tables

Trips
driver_id(INTEGER)rating(DECIMAL)trip_completed_at(TIMESTAMP)
10132026-02-10 10:00:00
1013.52026-02-09 12:00:00
10252026-02-10 08:00:00
10322026-02-08 15:00:00
10352026-02-01 09:00:00
1044.52026-02-07 11:00:00

Expected Output

driver_id(INTEGER)avg_rating(DECIMAL)
1032
1013.25

Tags

EasyASKED IN INTERVIEWBasic SQLAggregationDateTimeFiltering
5-10 min
72%

Hints