Write a SQL query to analyze enterprise customer usage by account, region, and month, and identify the top accounts driving revenue growth.
Use the provided accounts and monthly_usage tables. Calculate month-over-month revenue growth for accounts with a prior month, and return the two highest-growth accounts per region and month when growth is positive.
region, usage_month, account_id, account_name, revenue, usage_units, revenue_growth_amount, revenue_growth_pct, and region_rank.region, usage_month, region_rank, and account_id.| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Unique enterprise account identifier |
| account_name | VARCHAR(100) | Enterprise account name |
| region | VARCHAR(50) | Account geographic region |
| segment | VARCHAR(50) | Enterprise customer segment |
| Column | Type | Description |
|---|---|---|
| usage_idPK | INT | Unique usage record identifier |
| account_id | INT | Referenced enterprise account |
| usage_month | DATE | First day of the usage month |
| usage_units | INT | Consumed service usage units |
| revenue | NUMERIC(12,2) | Revenue attributed to the usage record |