SQL QuestSQL Interview Questions › Joins

Customers Who Never Ordered

MediumFreeQuerying BasicsJoins

Amazon's CRM team wants to re-engage registered buyers who've created an account but never placed an order — prime targets for dormant-user email campaigns. Write a SQL query that returns the customer name for every such account. Order by name ascending. This anti-join pattern (LEFT JOIN + NULL filter, or NOT IN / NOT EXISTS) is a bread-and-butter Amazon analyst question — the same logic powers every re-activation campaign.

Solve it in the browser editor →

Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".

Schema

customers

customer_idnameemailsignup_datemembershiptotal_orders
1John Smithjohn.smith@email.com2023-01-15Gold15
2Emma Wilsonemma.wilson@email.com2023-03-20Silver8
3Michael Brownmichael.brown@email.com2023-02-10Gold12

orders

order_idcustomer_idproductcategoryquantitypricetotalorder_datecountrystatus
11Laptop ProElectronics11299.991299.992024-01-15USAcompleted
22Wireless MouseElectronics249.9999.982024-01-16Canadacompleted
33Office ChairFurniture1349.99349.992024-01-17USAcompleted

Expected output: Names of buyers with zero marketplace orders

Hint

Use LEFT JOIN and check for NULL, or use NOT IN with a subquery

Concepts

SELECT LEFT JOIN WHERE LEFT JOIN / NOT IN

Practise the topic: SQL practice questions · JOIN practice

In these company practice sets

Amazon · Plaid · Snowflake

A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.

Related questions

Above-Average Departments (Derived Table)Medium · FreeLEFT JOIN NULL Semantics: Inactive CustomersMedium · FreeManagement Hierarchy OverviewMedium · FreeCount Direct ReportsMedium · FreeCustomer Recency AnalysisMedium · FreeMembership Tier Revenue AnalysisMedium · Free

Where would this cost you points in an interview?

Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.

Take the readiness test