Your question is Compare Current vs Previous Month. Start with the requirements and the two 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.
Avenue Code Commerce needs a regional performance report showing whether the current month is improving over the previous month.
Write a PostgreSQL query that compares June 2025 metrics with May 2025 for each region. Include only completed orders placed by active customers.
NULL for the percentage change when the previous revenue is zero.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| region | VARCHAR(30) | Customer sales region |
| VARCHAR(255) | Customer email address | |
| is_active | BOOLEAN | Whether the customer is active |
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| customer_id | INTEGER | Customer who placed the order |
| order_date | DATE | Date the order was placed |
| status | VARCHAR(20) | Order lifecycle status |
| order_amount | NUMERIC(12,2) | Revenue attributed to the order |