← Uber Interview Insights

Uber·Data Scientist·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026Remote

Summary

SQL-heavy technical screen for a Data Scientist role at Uber. Two tables, one prompt, and a pile of edge cases that made me realize I'd been sloppy about age calculations for years.

Questions Asked (2)

Q1

Given a drivers table and a trips table, write a query to return driver names whose average fare across completed trips is strictly greater than $10.00. Exclude canceled trips and null fares. Output driver name and average fare rounded to 2 decimal places, ordered by average fare descending then name ascending. Drivers with no completed trips should not appear.

Product Analytics & MetricsData Modeling
Author's notes

Felt pretty confident here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by filtering the trips table to only completed trips with non-null fares, then join with the drivers table to get driver names. Group by driver, compute the average fare, and filter for averages strictly greater than $10.00. Finally, round the average to 2 decimal places and order the results by average fare descending, then driver name ascending.

Pro tip: Clarify the definition of 'completed trips' and 'canceled trips' upfront—often there's a status column with values like 'completed', 'canceled_by_driver', etc. Also, consider using a subquery or CTE to pre-aggregate before joining to avoid performance issues with large datasets.

1. Filter and clean trips data

Select only trips where status indicates completion (e.g., status = 'completed') and fare is not null. This ensures we only consider valid completed trips.

2. Aggregate fares per driver

Group the filtered trips by driver_id and compute the average fare. Use AVG(fare) and round to 2 decimal places.

3. Join with drivers table

Join the aggregated results with the drivers table on driver_id to retrieve driver names. Use an inner join to exclude drivers with no completed trips.

4. Apply threshold and ordering

Filter the joined results to only include drivers whose average fare is strictly greater than 10.00. Then order by average fare descending and driver name ascending.

Key Points to Mention

  • Use of WHERE clause to filter completed trips and non-null fares before aggregation.
  • Use of GROUP BY driver_id with AVG(fare) to compute average fare per driver.
  • Use of INNER JOIN to ensure only drivers with completed trips are included.
  • Use of HAVING clause to filter after aggregation for average fare > 10.00.
  • Rounding the average fare to 2 decimal places using ROUND(AVG(fare), 2).
  • Ordering by average fare DESC and driver name ASC for deterministic output.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Using the same schema, count completed trips grouped by driver age bands (20 to 35 and 36 to 45) as of a specific reference date. Age must be calculated accurately using the actual calendar, not a 365-day approximation. Ignore drivers outside those two bands.

Data ModelingProduct Analytics & Metrics
Author's notes

This is where I fumbled.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and the reference date, then write a SQL query that joins trips and drivers, filters for completed trips, and computes age using date functions that account for leap years. Group by age bands and count trips, ensuring drivers outside the bands are excluded.

Pro tip: Use a CTE to calculate age once and avoid repeating the logic, and explicitly mention that you're using date_diff or equivalent to handle leap years correctly.

1. Clarify schema and requirements

Confirm the tables, columns, and the reference date. Ensure you know how 'completed' trips are defined and the exact age bands.

2. Compute driver age accurately

Use a date function like DATEDIFF or DATE_DIFF to calculate age as of the reference date, ensuring leap years are handled correctly.

3. Filter and join data

Join trips with drivers on driver_id, filter for completed trips, and restrict to drivers whose age falls in the specified bands.

4. Group and count

Group by the age band and count the number of trips, using a CASE statement to assign each driver to the correct band.

5. Validate and present results

Check for edge cases like drivers exactly at band boundaries, and present the counts clearly.

Key Points to Mention

  • Use of date functions that account for leap years (e.g., DATEDIFF in MySQL, DATE_DIFF in BigQuery).
  • Definition of 'completed' trips (e.g., status = 'completed').
  • Handling of drivers with missing birthdates or null values.
  • Inclusion/exclusion criteria for age bands (20-35 and 36-45 inclusive).
  • Efficiency considerations: filtering before joining if possible, using indexes.
  • Potential need to handle time zones if the reference date is time-sensitive.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.