Anti-join pattern
SQL
Medium
3 views
Problem Description
Find products that never appear in OrderItems.
Sample Test Case
Input:
Products, OrderItems
Constraints
Use left join null or not exists
Official Solution
SELECT p.product_id, p.name FROM Products p LEFT JOIN OrderItems oi ON oi.product_id = p.product_id WHERE oi.product_id IS NULL;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!