Customers Inactive in February 2024
Which customers placed no orders in February 2024?
- Joins
- NULL handling
- Filtering
- Sorting
Challenge brief
Understand the request
Growth Marketing is running a February re-engagement campaign and needs customers who went quiet last month.
Find customers who did not place any order in February 2024.
Return
- customer_id
- first_name
- last_name
- country
Constraints
- The inactivity window begins on February 1, 2024 and covers all fixture dates after that boundary
- Include customers with zero February orders, even if they ordered in January
- Order by customer_id ascending
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
customers
customer_idINTEGERfirst_nameVARCHAR(50)last_nameVARCHAR(50)emailVARCHAR(100)countryVARCHAR(50)
orders
order_idINTEGERcustomer_idINTEGERorder_dateDATETIME
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
You need customers with NO February order. Put the date filter inside the JOIN condition (not WHERE) so customers with no February orders still appear from the left side of a LEFT JOIN.
Hint 2
LEFT JOIN customers to orders with TWO conditions: ON c.customer_id = o.customer_id AND o.order_date >= '2024-02-01'. Then WHERE o.order_id IS NULL keeps only customers with no February order row.
Hint 3
Scaffold: preserve customers, restrict matching orders at the join boundary to February dates, then retain customers whose matching order key is absent.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT c.customer_id, c.first_name, c.last_name, c.email, c.country FROM customers c LEFT JOIN orders o ON c.customer_id = o.customer_id AND o.order_date >= '2024-02-01' WHERE o.order_id IS NULL ORDER BY c.customer_id;Why this works
Putting the date filter in the ON clause (not WHERE) is critical. If you put it in WHERE, customers with only January orders get filtered out entirely. In ON, the date condition narrows which order rows join — customers with no matching February rows still appear with NULLs on the orders side.
Success check
2 customers — Carol White and David Brown
Expected result
Use this output to verify values, aliases, ordering, and row count.
| customer_id | first_name | last_name | country | |
|---|---|---|---|---|
| 1003 | Carol | White | carol.w@email.com | Canada |
| 1004 | David | Brown | david.b@email.com | USA |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Explore related company challenges
Airbnb
Independent Airbnb-style marketplace, booking, listing, payment, review, and guest analytics SQL practice.
Uber
Independent Uber-style mobility marketplace SQL practice covering trips, drivers, riders, pricing, payments, and promotions.
Microsoft
Independent Microsoft-style cloud, productivity, subscription, usage, support, and customer analytics SQL practice.
Return to the complete interview preparation experience.