Operations & Supply Chain Analytics · Mission 9 of 30Easy

Stock-out risk: SKUs with under 7 days of supply

Filter on latest snapshot, JOIN to dim for readable output.

The Brief

Devon ParkWarehouse Leadslack-dm

Stock-out risk alert: which SKUs have under 7 days of supply on the latest snapshot? Pull sku_name, warehouse_name, and days_of_supply. Use the latest snapshot date only. Same dedup trick as before — that table has duplicates.

You'll practice

Latest snapshotWHERE filterJOIN to dim

Tables & columns available

fact_inventory_snapshotsfact6 columns
ColumnTypeKey
snapshot_idINTPK
sku_idINTFK → dim_skus
warehouse_idINTFK → dim_warehouses
snapshot_dateTEXT
on_hand_qtyINT
days_of_supplyREAL
dim_skusdim6 columns
ColumnTypeKey
sku_idINTPK
sku_codeTEXT
sku_nameTEXT
categoryTEXT
unit_costREAL
reorder_pointINT
dim_warehousesdim3 columns
ColumnTypeKey
warehouse_idINTPK
warehouse_nameTEXT
regionTEXT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Filter to the latest snapshot: `WHERE snapshot_date = (SELECT MAX(snapshot_date) FROM fact_inventory_snapshots)`.

Hint 2

Filter on `days_of_supply < 7`. JOIN to `dim_skus` for sku_name and `dim_warehouses` for warehouse_name.

Hint 3

Use DISTINCT to handle duplicate snapshot rows. ORDER BY days_of_supply ASC so the most-at-risk float to the top.