3. Products With No Purchases

Easy

products(product_id, product_name) and orders(order_id, product_id, ordered_at)

Return the products that have never been ordered, as product_id and product_name.

orders contains rows whose product_id is NULL. An anti-join written with NOT IN over a column containing NULL returns nothing at all -- which is the trap this problem is about.

Tables

orders

order_id  product_id  ordered_at
--------  ----------  -------------------
10        1           2026-03-01 10:00:00
11        1           2026-03-02 10:00:00
12        3           2026-03-03 10:00:00
13        NULL        2026-03-04 10:00:00

products

product_id  product_name
----------  ------------
1           Keyboard
2           Monitor
3           Webcam
4           Stylus

Expected result

product_id  product_name
----------  ------------
2           Monitor
4           Stylus

Sign in to write and run your own code.

Write one SELECT query