Customer Order Frequency

ASKED IN INTERVIEW
2pts
Amazon

Problem Statement

Amazon Prime Day events often span June and July. Marketing wants to find "loyal high-spenders" who spent a total of $100 or more on all their orders in June 2026 AND $100 or more on all their orders in July 2026.

Rules:

  • Spending is calculated as (quantity * price).
  • The customer must meet the $100 threshold in each month individually.
  • Output columns: customer_id, name.
  • Results must be sorted by customer_id in ascending order.
Tests your understanding of
Date Manipulation, Aggregation and Filtering

Input Tables

Customers
customer_id(INTEGER)name(VARCHAR)
1Winston
2Julia
3O'Brien
Product
product_id(INTEGER)price(INTEGER)
1050
2010
30150
Orders
order_id(INTEGER)customer_id(INTEGER)product_id(INTEGER)order_date(DATE)quantity(INTEGER)
11102026-06-012
21302026-07-051
32202026-06-155
42102026-07-202
53302026-06-101

Expected Output

customer_id(INTEGER)name(VARCHAR)
1Winston

Tags

EasyASKED IN INTERVIEWDate ManipulationAggregationFiltering
15-20 min
64%

Hints