Your question is Compare Current vs Historical Customer Behavior. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a PostgreSQL query that compares each customer's latest active month on ACME House with their own prior 3-month baseline. Use only completed orders, aggregate behavior by calendar month, and return customers only when a full 3-month history exists.
| Column | Type | Description |
|---|---|---|
| order_id | INT | |
| customer_id | INT | |
| order_date | DATE | |
| order_status | VARCHAR(20) | |
| order_amount | NUMERIC(10,2) | |
| channel | VARCHAR(20) |