Skip to main content
All Questions

Lyft Ride Requests

Easy
Unlock detailed company stats for this questionUpgrade

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).

Related courses

Course

Data Analyst Interview Prep

Ace your data analyst interviews—whether you're targeting product, marketing, or business analyst roles. Tackle real take-home case studies, sharpen your technical and dashboarding skills, and get strategies from interviewers at top tech companies and startups.

Course

Data Science Interview Prep

Land your dream data science role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Practice statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.