LEFT JOIN
of the Trips
table with the Users
table on client_id
to get client information.LEFT JOIN
of the result with the Users
table on driver_id
to get driver information.WHERE
clause to filter out trips with banned clients or drivers and to consider only trips within the specified date range.request_at
date.request_at
date and the calculated cancellation rate in the final output.erDiagram Users { int users_id enum banned enum role } Trips { int id int client_id int driver_id int city_id enum status date request_at } Users ||--o{ Trips : "client_id" Users ||--o{ Trips : "driver_id"