Bain & Company's analytics team wants a monthly view of revenue performance by sales region. Write a PostgreSQL query that aggregates completed sales and calculates a running three-month moving average for each region.
| Column | Type | Description |
|---|---|---|
| region_idPK | INTEGER | Unique region identifier |
| region_name | VARCHAR(50) | Sales region name |
| market | VARCHAR(50) | Market served by the region |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique transaction identifier |
| region_id | INTEGER | Region associated with the transaction |
| sale_date | DATE | Transaction date |
| revenue | NUMERIC(12,2) | Transaction revenue |
| status | VARCHAR(20) | Transaction status |