Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Average ETA and Outlier Trips

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Average ETA and Outlier Trips. Start with the requirements and the one table on the right.

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.

Problem

Uber's Operations team wants a quick quality check on trip ETA data from the Driver app. Write a SQL query to calculate the overall average ETA and identify trips whose ETA is unusually high.

Requirements

  1. Use only rows where eta_minutes is not NULL.
  2. Return two metrics in one result set:
    • the overall average ETA across all valid trips
    • the number of outlier trips where eta_minutes is greater than 2 times the overall average ETA
  3. Output the columns as avg_eta_minutes and outlier_trip_count.

Because this is an easy question, use a single table only.

Schema

trip_eta_events
ColumnTypeDescription
trip_idPKINTUnique trip identifier
city_nameVARCHAR(50)City where the trip was requested
rider_surfaceVARCHAR(50)Uber surface or product where ETA was displayed
eta_minutesDECIMAL(5,2)Estimated time of arrival in minutes
event_dateDATEDate of the ETA event
Tablestrip_eta_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results