Skip to main content

Lyft Ride Requests

EasyPremium

Lyft is a popular ride-sharing platform that connects drivers with riders. Users place a car booking request when they need a ride, and while many of these requests get matched with drivers, some don't get any match. You are given the following tables:

  1. users:
    • user_id (Primary key): An identifier for each user.
    • user_name: The name of the user.
    • email: The email address of the user.
  2. bookings:
    • booking_id (Primary key): An identifier for each booking.
    • user_id (Foreign key): The ID of the user who made the booking.
    • driver_id: The ID of the driver assigned for the booking (this can be null if no driver is matched).
    • booking_time: The timestamp when the booking was placed.
    • status: The status of the booking (e.g., "Matched", "Unmatched").

Write a SQL query to find the average number of unmatched bookings per user. Your output should contain the following columns: user_id, user_name, email, avg_unmatched_bookings (rounded to the nearest 2 decimal place).