RienSQL
TASK #216 · Medium · Cabify

Rides 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.
Expected columnsride_id issueCabify
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
driversdriver_id, driver_name, city, car_model
driver_shiftsshift_id, driver_id, shift_start, shift_end
ridesride_id, driver_id, city, requested_at, status, started_at, ended_at, distance_km, surge_multiplier, fare_eur