Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Compare Regional Performance by Month

MediumSQL · PostgreSQL00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the SQL screen.

The question is on your right: Compare Regional Performance by Month. Read through the requirements and the three tables first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

You need to log in / sign up to run or submit.

Problem

Compare regional performance over time

Write a PostgreSQL query that summarizes Lyft ride performance by region_name and calendar month for Q1 2024. Your result should show completed rides, total gross bookings, average driver rating, the month-over-month change in completed rides, and a trend label based on that change.

Only include region-months with at least 2 completed rides.

Schema

Tables
  • lyft_regions(region_id, region_name, country_code)
  • lyft_drivers(driver_id, region_id, driver_name, signup_date)
  • lyft_rides(ride_id, driver_id, ride_date, status, gross_bookings, driver_rating)
Tableslyft_regionslyft_driverslyft_rides
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results