Supply Chain & OpsMedium
Detect stock-out events and their duration from hourly inventory snapshots.
Seen at: Amazon · Walmart · FedEx · UPS
Given inventory_snapshots(sku_id, warehouse_id, snapshot_ts, units_on_hand) recorded hourly, write SQL that identifies each stock-out episode (a contiguous run where units_on_hand = 0) and its duration.
Draft your answer
Saved to this browser only. Try it before you peek at the model answer.
Stuck? Peek at a hint
Reveals the model answer and the self-score rubric.