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
First-Week Trip Threshold Query
00:00
5 left

First-Week Trip Threshold Query

MediumSQL · PostgreSQL

Problem

Write a query to identify drivers who have completed more than 50 trips in their first week at Uber Drivers, joining driver onboarding tables with trip dispatch logs.

Use the onboarding date as day one and count only completed trips during the following seven calendar days. Return qualifying drivers in descending trip-count order.

Output

  1. One row per qualifying driver.
  2. Columns: driver_id, onboarding_date, and first_week_completed_trips.
  3. Order by trip count descending, then driver_id ascending.

Schema

driver_onboarding
ColumnTypeDescription
driver_idPKINTUnique Uber Drivers driver identifier
onboarding_dateDATEDate the driver completed onboarding
trip_dispatch_logs
ColumnTypeDescription
log_idPKINTUnique dispatch log identifier
driver_idINTDriver associated with the dispatch records
dispatch_dateDATEDate of the dispatch activity
trip_statusVARCHAR(20)Status of the trips represented by the log
completed_trip_countINTNumber of completed trips represented by the log
Tablesdriver_onboardingtrip_dispatch_logs
Interviewer

Your question is First-Week Trip Threshold Query. 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.