Customers who never ordered

MediumNULLs and anti-joinsE-commerce

The problem

Find customers who have never placed any order (of any status).

Return name and city. Some cities are NULL — keep those customers.

Tables · Online shop

Click a table or column name to insert it into your query.

  • INTEGER · primary key
  • TEXT
  • TEXT · can be NULL
  • DATE
Sample rows (10 total)
Sample rows from customers
customer_idnamecitysignup_date
1Aarav MehtaMumbai2025-01-10
2Diya NairBengaluru2025-01-18
3Kabir SinghDelhi2025-02-02
4Meera IyerChennai2025-02-14
5Rohan DasKolkata2025-03-01

  • INTEGER · primary key
  • INTEGER · → customers
  • DATE
  • TEXT · delivered | cancelled | returned | pending
  • INTEGER · rupees
Sample rows (20 total)
Sample rows from orders
order_idcustomer_idorder_datestatusamount
112025-05-01delivered1200
212025-05-15delivered800
312025-06-02cancelled500
422025-05-03delivered2500
522025-05-20delivered450

Next: Employee and manager →

Ctrl/⌘ + Enter runs the query. Table and column names are suggested as you type. Press Esc then Tab to leave the editor with the keyboard.

Expected output (3 rows)
Expected output
namecity
Tara JoshiPune
Sana KhanNULL
Neel PatelAhmedabad

Row order doesn’t matter for this question. Numbers are compared with a tiny tolerance; text must match exactly.

Stuck?

Stored on this device only. Your latest query and “solved” status are remembered in this browser only. They don’t sync between devices, and clearing your browser data removes them.