TASK #216 · Medium · CabifyRides Without a Matching Driver
Your brief
Cabify analysts are checking data quality: every completed ride
(status = 'completed') in rides must have a driver from
drivers. Cancelled rides do not need to be checked.
Write a query that returns ride_id of completed rides with an error and issue (the error type): 'missing_driver_id' if driver_id is NULL, or 'unknown_driver' if there is no driver with that driver_id in drivers.
Write a query that returns ride_id of completed rides with an error and issue (the error type): 'missing_driver_id' if driver_id is NULL, or 'unknown_driver' if there is no driver with that driver_id in drivers.
Ctrl / ⌘ + ↵
Result
Write a query and run it to see the results.
Schema
driversdriver_id, driver_name, city, car_modeldriver_shiftsshift_id, driver_id, shift_start, shift_endridesride_id, driver_id, city, requested_at, status, started_at, ended_at, distance_km, surge_multiplier, fare_eur