Your question is Detect Post-Launch Customer Behavior Shifts. Start with the requirements and the three tables 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.
NovaCart launched a new product on 2024-04-01 and wants to identify customers whose purchasing behavior changed afterward. Write a SQL query to compare each customer's activity in the 30 days before launch vs. the 30 days after launch.
pre_orders, post_orders, pre_spend, and post_spend using orders in the windows 2024-03-02 to 2024-03-31 and 2024-04-01 to 2024-04-30.customer_id.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer full name |
| segment | VARCHAR(50) | Customer segment |
| signup_date | DATE | Date the customer signed up |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer who placed the order |
| order_date | DATE | Date the order was placed |
| order_amount | DECIMAL(10,2) | Total order amount |
| channel | VARCHAR(30) | Purchase channel |
| Column | Type | Description |
|---|---|---|
| launch_idPK | INT | Unique launch identifier |
| product_name | VARCHAR(100) | Product name |
| launch_date | DATE | Launch date for the product |