← PayPal Interview Insights

PayPal·Data Scientist·Technical Phone Screen·Senior

Senior
May 2026

Summary

PayPal data scientist interview that was basically a deep SQL exercise built around a rideshare/airport pickup product. Three questions, all SQL, all connected to the same schema. The WHERE vs ON join filter thing came up and I think that's where a lot of people get tripped up.

Questions Asked (3)

Q1

Given a rideshare schema with drivers, riders, trips, and airports tables, write a SQL query to return the top 10 active drivers by completed airport pickup trips in the US over the last 28 days, excluding fraudulent riders. Include total airport requests and completion rate, with specific tie-breaking rules.

Product Analytics & MetricsData Modeling
Author's notes

The multi-filter part is where I slowed down.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and business definitions (e.g., completed trips, airport pickups, fraudulent riders, active drivers). Then outline a multi-step SQL query using CTEs to filter trips, join tables, aggregate metrics, and apply ranking with tie-breaking rules. Finally, discuss potential edge cases and validation.

Pro tip: Demonstrate awareness of data quality and business context by asking about how fraudulent riders are flagged and whether airport pickups are identified by trip coordinates or a dedicated column. Also, mention that tie-breaking should be deterministic and aligned with business priorities (e.g., higher completion rate first).

1. Clarify requirements and schema

Ask clarifying questions about table structures, definitions of 'completed', 'airport pickup', 'active driver', and 'fraudulent rider'. Confirm the time window and tie-breaking rules.

2. Filter and join relevant data

Use CTEs to filter trips to completed airport pickups in the US within the last 28 days, exclude trips by fraudulent riders, and join with drivers to get driver details.

3. Aggregate metrics per driver

Group by driver and calculate total completed airport pickups, total airport requests (including incomplete), and completion rate (completed/requests).

4. Rank and apply tie-breaking

Use window functions (e.g., ROW_NUMBER or RANK) to order drivers by completed pickups descending, then by completion rate descending, then by driver ID ascending for deterministic ties.

5. Select top 10 and validate

Return the top 10 drivers with all required metrics. Discuss potential edge cases (e.g., drivers with zero requests) and how to validate results.

Key Points to Mention

  • Use of CTEs for readability and modularity
  • Correct filtering for completed trips, airport pickups, US location, and last 28 days
  • Exclusion of fraudulent riders via a flag or join
  • Calculation of completion rate as completed trips divided by total requests
  • Application of tie-breaking rules using window functions
  • Consideration of data quality issues and business definitions

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

Q2

Using the same schema and window, compute cancellation rates broken out by who canceled (driver, rider, or system) for each US airport, only including airports with at least 100 total requests.

Product Analytics & MetricsRoot Cause Analysis
Author's notes

Conditional aggregation with SUM(CASE WHEN ...) for each canceler type.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a window function to compute the total requests per airport, then filter to airports with at least 100 total requests. For those airports, calculate the cancellation rate for each canceller type (driver, rider, system) by dividing the count of cancellations by that type by the total requests for the airport.

Pro tip: Clarify whether 'cancellation rate' should be computed as a percentage of total requests or as a percentage of all cancellations; the former is more common in product analytics. Also, ensure you handle NULLs in the canceller type appropriately, as they may represent non-cancelled requests.

1. Understand the schema and define metrics

Identify the relevant tables and columns: requests, cancellations, canceller type (driver, rider, system), and airport. Define cancellation rate as the proportion of requests that were cancelled by each canceller type.

2. Filter airports with at least 100 total requests

Use a subquery or window function to compute total requests per airport, then filter to only include airports where this total is >= 100.

3. Compute cancellation counts by canceller type

For the filtered airports, count the number of cancellations for each canceller type (driver, rider, system). Ensure you only count actual cancellations, not all requests.

4. Calculate cancellation rates

Divide the cancellation count for each canceller type by the total requests for that airport to get the cancellation rate. Format as a percentage if needed.

5. Present results clearly

Output the airport, canceller type, and cancellation rate, ordered by airport and canceller type for readability. Consider pivoting if a wide format is preferred.

Key Points to Mention

  • Use of window functions (e.g., SUM() OVER (PARTITION BY airport)) to compute total requests per airport without collapsing rows.
  • Filtering with a HAVING clause or a subquery to include only airports with >= 100 total requests.
  • Handling of NULL or missing canceller types: they likely indicate non-cancelled requests and should be excluded from cancellation counts.
  • Definition of cancellation rate: typically cancellations by a specific canceller divided by total requests, not total cancellations.
  • Potential need to join tables if requests and cancellations are in separate tables.
  • Consideration of time window: ensure the analysis is restricted to the specified window (e.g., last 30 days) if applicable.

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

Q3

Still using the same schema, write a query to find the top 10 riders by number of canceled airport pickup trips in the US over the same 28-day window.

Product Analytics & MetricsData Modeling
Author's notes

Simplest of the three.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by identifying the relevant tables and columns for trips, cancellations, and rider information, then filter for US airport pickups within the 28-day window. Aggregate canceled trips per rider, sort descending, and limit to 10, ensuring you handle date ranges and status filters correctly.

Pro tip: Clarify the definition of 'canceled' (e.g., by rider, driver, or system) and whether 'airport pickup' includes both departure and arrival trips; these nuances show attention to metric definitions and prevent misinterpretation.

1. Identify relevant tables and columns

Locate the trips table with fields like trip_id, rider_id, pickup_location_type, status, and trip_date. Ensure you have a way to identify US locations and airport pickups.

2. Filter trips by time window and criteria

Apply filters: trip_date within the last 28 days, country = 'US', pickup_location_type = 'airport', and status = 'canceled'. Use appropriate date functions based on the schema.

3. Aggregate canceled trips per rider

Group by rider_id and count the number of canceled trips. Optionally join with a riders table to get rider names for readability.

4. Sort and limit results

Order the aggregated counts in descending order and limit to the top 10 riders. Include tie-breaking logic if necessary (e.g., by rider_id).

Key Points to Mention

  • Correctly defining 'canceled' status and 'airport pickup' based on schema (e.g., status = 'canceled', pickup_type = 'airport').
  • Handling the 28-day window dynamically (e.g., using CURRENT_DATE - INTERVAL '28 days' or a specific date range).
  • Filtering for US trips (e.g., country = 'US' or city in US list).
  • Aggregating with COUNT and GROUP BY rider_id, then ORDER BY count DESC LIMIT 10.
  • Considering whether to include only completed trips or all trips for cancellation rate context.
  • Potential need to join with a riders table to display rider names or other details.

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