Find Users with No Orders

ASKED IN INTERVIEW
2pts
Walmart

Problem Statement

Walmart marketing teams want to reach out to customers who have become inactive. You need to find all customers who have not placed any orders in the last 6 months (relative to today's date, which is 2026-02-08).

A customer is considered inactive if there is no record of an order for them in the system that was placed on or after 2025-08-08.

Rules:

  • Include customers who have never placed an order at all.
  • Output columns: customer_id, customer_name.
  • Results must be sorted by customer_id in ascending order.
Tests your understanding of
Left Join, Filtering and Date Functions

Input Tables

customers
customer_id(INTEGER)customer_name(VARCHAR)email(VARCHAR)
1Alice Smith[email protected]
2Bob Johnson[email protected]
3Charlie Brown[email protected]
4David Miller[email protected]
5Eve Adams[email protected]
orders
order_id(INTEGER)customer_id(INTEGER)order_date(DATE)
10112026-01-15
10222024-12-01
10332025-09-20
10452023-01-01
customer_segments
customer_id(INTEGER)segment_name(VARCHAR)
1Premium
2Standard
4New

Expected Output

customer_id(INTEGER)customer_name(VARCHAR)
2Bob Johnson
4David Miller
5Eve Adams

Tags

EasyASKED IN INTERVIEWLeft JoinFilteringDate Functions
10-15 min
75%

Hints