SQL Challenges · THE CHRISTMAS HEIST!
The Secret Route
Difficulty: hard
Detective Quacker's suspicion grows. "GPS gaps... packages being split... but wait, didn't we see Coach Waddles going somewhere unexpected?" Captain Cosmos descends with satellite data and GPS trajectory analysis glowing with insights. "Detective! I've mapped Coach Waddles' complete secret route using all that GPS data! The warehouse is at coordinates 45.5200 latitude, -122.6800 longitude. For Coach Waddles' deliveries, I want to know which district he visited the most. Where did our suspect sp…
Your task
Find which district received the most deliveries from Coach Waddles (id = 1). You will be working with `deliveries_log` and `duck_households` tables.
Tables
deliveries_log (10000 rows)
| column | type |
|---|---|
delivery_id | INTEGER |
household_id | INTEGER |
delivered_by | INTEGER |
delivery_time | TIMESTAMP |
success | BOOLEAN |
parent_delivery_id | INTEGER |
delivery_metadata | JSON |
duck_households (200 rows)
| column | type |
|---|---|
household_id | INTEGER |
address | VARCHAR |
district | VARCHAR |
latitude | DOUBLE |
longitude | DOUBLE |
household_size | INTEGER |
income_level | VARCHAR |
reported_missing | BOOLEAN |
Database: https://dbquacks.com/data/databases/christmas_local.duckdb
This page as markdown: https://dbquacks.com/challenges/christmas/13.md
More: practice SQL exercises online · SQL interview questions