Aggregate over a daily snapshot fact, JOIN to a dim, sort. The shape behind every weekly inventory review.
Monday morning. Pull total units on hand by store as of 2026-03-30 — only the 50 stores' hot SKUs (the 20 SKUs we track daily). Three columns: store_id, store_name, total_units. ORDER BY total_units DESC, store_id ASC. Top 10 only — that's the quick snapshot the regional VPs want first.
| Column | Type | Key |
|---|---|---|
| snapshot_id | INT | PK |
| store_id | INT | FK → dim_stores |
| sku_id | INT | FK → dim_skus |
| snapshot_date | TEXT | |
| units_on_hand | INT |
| Column | Type | Key |
|---|---|---|
| store_id | INT | PK |
| store_name | TEXT | |
| region | TEXT | |
| city | TEXT | |
| state | TEXT | |
| sq_ft | INT | |
| opened_date | TEXT |
Each hint you reveal reduces the XP you can earn. Try the query first.
JOIN fact_inventory_by_location to dim_stores.
Filter snapshot_date = '2026-03-30' — the most recent date in the seed.
SUM(units_on_hand), GROUP BY store_id and store_name.
ORDER BY total_units DESC, store_id ASC, LIMIT 10.