SQL Challenges · THE CHRISTMAS HEIST!

The Christmas Miracle Revealed

Difficulty: hard

Detective Quacker stands up, realization dawning. Packages kept warm... delivered to low-income districts... packages split and redistributed... This cant be a crime! Everyone gathers as Detective Quacker prepares the final revelation. Time for the ultimate query, Duckbert! This is it—the complete picture. I need to count how many deliveries meet ALL these criteria: theyre part of the secret_santa program (check the metadata) AND they went to low-income households. This number will reveal the t…

Your task

Count how many successful deliveries went to low-income households AND were part of the secret_santa program. You will be working with `deliveries_log` and `duck_households` tables.

Tables

deliveries_log (10000 rows)

columntype
delivery_idINTEGER
household_idINTEGER
delivered_byINTEGER
delivery_timeTIMESTAMP
successBOOLEAN
parent_delivery_idINTEGER
delivery_metadataJSON

duck_households (200 rows)

columntype
household_idINTEGER
addressVARCHAR
districtVARCHAR
latitudeDOUBLE
longitudeDOUBLE
household_sizeINTEGER
income_levelVARCHAR
reported_missingBOOLEAN

Database: https://dbquacks.com/data/databases/christmas_local.duckdb

This page as markdown: https://dbquacks.com/challenges/christmas/15.md

Play this challenge →