22. Customers Who Never Ordered

Easy

customers(customer_id, customer_name) and orders(order_id, customer_id)

Return every customer with no order history, as customer_id and customer_name, ordered by customer_id.

orders contains a row whose customer_id is NULL. NOT IN over a column holding NULL returns no rows at all, which is the usual way this gets written wrong.

Tables

customers

customer_id  customer_name
-----------  -------------
1            Ada
2            Bo
3            Cy
4            Di

orders

order_id  customer_id
--------  -----------
10        1
11        1
12        3
13        NULL

Expected result

customer_id  customer_name
-----------  -------------
2            Bo
4            Di

Sign in to write and run your own code.

Write one SELECT query