#996

Products That Were Ordered

The catalog flags products that appear at least once in order_items. Rewrite the report in a set-based form and return the unique product id values, sorted by id.

Original query
SELECT p.id FROM products p WHERE EXISTS (SELECT 1 FROM order_items oi WHERE oi.product_id = p.id) ORDER BY p.id

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.

id
1
2
3

Your query result will appear here