Uber calls a rider 'in-the-moment' when their first ride happened on the same date they signed up. For those riders, the team wants to know how many days pass between signing up and taking a second ride. A rider's rides are ordered by ride_date, then ride_id, so two rides on the same date are first and second in ride_id order. In-the-moment riders who never took a second ride are left out. Write an SQL query that returns a single column, avg_days_to_second_ride: the average number of days between signup_date and the second ride's ride_date, rounded to 2 decimal places.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.