The Hopper Company Queries I interview question is a complex SQL challenge involving a ride-sharing service. You are given tables for Drivers, Rides, and AcceptedRides. You need to produce a report for each month of the year 2020 showing:
Uber and similar logistics companies use this "Hard" database question to test a candidate's ability to perform complex analytical queries. It evaluates your skill in creating a "Time Series" in SQL (generating months), performing multiple LEFT JOIN operations to ensure all months are present, and handling cumulative aggregations. It’s a high-level test of reporting logic and data modeling.
This problem follows the Time Series Generation and Aggregation pattern.
Rides and AcceptedRides tables to count rides that occurred in each month.LEFT JOIN from the "Months" table to the aggregated data to ensure months with zero drivers or zero rides are included.When asked to report data by month, always start by ensuring you have a "base" table of months. This prevents "gaps" in your data. Practice the WITH RECURSIVE syntax or a simple union of numbers to generate sequences in SQL.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Hopper Company Queries II | Hard | Solve | |
| Hopper Company Queries III | Hard | Solve | |
| Human Traffic of Stadium | Hard | Solve | |
| Trips and Users | Hard | Solve | |
| Analyze Organization Hierarchy | Hard | Solve |