Look only at January-April 2026 (order_date from 2026-01-01 to 2026-04-30) and ignore orders with status 'CANCELLED'. Find customers who ordered in ALL four months and whose monthly spend strictly increased every month (Jan < Feb < Mar < Apr). Return customer_id, jan_spend and apr_spend (ROUND 2). Order by customer_id.
| Column | Type |
|---|---|
| order_id | INTEGER |
| customer_id | TEXT |
| order_date | DATE |
| amount | REAL |
| status | TEXT |
| order_id | customer_id | order_date | amount | status |
|---|---|---|---|---|
| 1 | c1 | 2026-01-05 | 100 | DELIVERED |
| 2 | c1 | 2026-02-07 | 150 | DELIVERED |
| 3 | c1 | 2026-03-02 | 120 | DELIVERED |
| 4 | c1 | 2026-03-20 | 80 | DELIVERED |
| 5 | c1 | 2026-04-11 | 260 | DELIVERED |
| 6 | c2 | 2026-01-09 | 50 | DELIVERED |
| 7 | c2 | 2026-02-09 | 80 | DELIVERED |
| 8 | c2 | 2026-03-09 | 70 | DELIVERED |
| customer_id | jan_spend | apr_spend |
|---|---|---|
| c1 | 100 | 260 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Referral Tree Size per Root User · Peak Concurrent Meetings per Org ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.