Find stock shortages
Return warehouse name, item name and quantity where quantity is below reorder_level, ordered by warehouse id and item id.
Try it yourself
Open a fresh temporary warehouse inventory dataset. Write your query and use Check answer. Checking uses a separate, clean sample so edits to your workspace cannot change the expected answer. Matches are based on this dataset, not a proof for every possible database.
Open exercise →Sample schema
warehouses(id, name) items(id, sku, name, reorder_level) stock(warehouse_id, item_id, quantity) movements(id, item_id, warehouse_id, delta, moved_at)
About this dataset · Learning paths · SQL reference
Show a hint
Join stock to items and warehouses; compare quantity with reorder_level.
Show one solution
SELECT w.name, i.name, s.quantity FROM stock s JOIN items i ON i.id=s.item_id JOIN warehouses w ON w.id=s.warehouse_id WHERE s.quantity<i.reorder_level ORDER BY w.id,i.id;Other queries can produce the same answer. Column aliases are ignored; column order and row order are checked.