AdvancedJOINs (INNER, LEFT, RIGHT, FULL)
Find products never ordered (LEFT anti-join)
The query
SQL
SELECT
p.product_id,
p.name,
p.price,
p.stock
FROM products p
LEFT JOIN order_items oi ON p.product_id = oi.product_id
WHERE oi.item_id IS NULL
ORDER BY p.stock DESC;Note
“Products with no orders — useful for inventory cleanup. Alternative: NOT EXISTS or NOT IN.