Products Never Sold
Programming Interview
Medium
5 views
Problem Description
Tables: Products(product_id, name), OrderItems(order_id, product_id). Find products that never appear in OrderItems.
Input Format
SQL tables are described in the question.
Output Format
Write the SQL query.
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!