Find items without stock records

Return item names with no stock row, ordered by 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

Use NOT EXISTS to distinguish missing records from zero quantity.

Show one solution
SELECT i.name FROM items i WHERE NOT EXISTS (SELECT 1 FROM stock s WHERE s.item_id=i.id) ORDER BY i.id;

Other queries can produce the same answer. Column aliases are ignored; column order and row order are checked.

Keep practicing

Total stock including missing items → · All exercises