Cancellation Rate (Unbanned Users)
Problem
**[Asked at Uber]**
A trip is included only if **both the client and driver are not banned**.
Calculate the **cancellation rate** as a percentage rounded to 2 dp.
Tables
Example rows — the live problem includes the full dataset.
users
| user_id | is_banned |
|---|
trips
| trip_id | client_id | driver_id | status | trip_date |
|---|
Expected output
Your answer should return 1 row with the columns cancellation_rate.
Starter code (SQL)
SELECT *
FROM users;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock