Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Compare Regional Performance by Month
00:00
5 left

Compare Regional Performance by Month

HardSQL · PostgreSQL

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
Interviewer

Your question is Compare Regional Performance by Month. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.