Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
SQL Trends in Wait Times
00:00
5 left

SQL Trends in Wait Times

MediumSQL · PostgreSQL

Problem

Waymo Data Science wants to monitor monthly ride-hail wait times across service zones. Write a PostgreSQL query using data from the past 12 complete months, from September 2025 through August 2026, as of August 29, 2026.

Requirements

  1. Include only completed ride requests in the specified 12-month period and join each request to its service zone.
  2. Calculate monthly average wait time in seconds and the number of requests with recorded wait times for each zone.
  3. Use a window function to compare each zone's average with its previous reported month, and classify the trend as rising, falling, stable, or no_prior_month.
  4. Return results ordered by zone and month. Ignore NULL wait times when calculating averages.

Schema

ride_requests
ColumnTypeDescription
request_idPKINTUnique ride request identifier
zone_idINTReferences service_zones.zone_id
requested_atTIMESTAMPTimestamp when the ride was requested
wait_secondsINTObserved rider wait time in seconds
statusVARCHAR(20)Ride request status
service_zones
ColumnTypeDescription
zone_idPKINTUnique service-zone identifier
zone_nameVARCHAR(100)Waymo service-zone name
Tablesride_requestsservice_zones
Interviewer

Your question is SQL Trends in Wait Times. Start with the requirements and the two 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.