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.region, current_month, previous_month, current_orders, previous_orders, current_revenue, previous_revenue, revenue_change, revenue_change_pct.current_month and previous_month as YYYY-MM strings.revenue_change_pct to two decimal places.NULL for revenue_change_pct when previous_revenue is NULL, as well as when it 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 |