Accenture España wants to identify the highest-value customers in each sales region. Write a SQL query to rank customers by their total revenue within each region.
region and customer_id.| Column | Type | Description |
|---|---|---|
| region_idPK | INT | Primary key for the region |
| region_name | VARCHAR(100) | Region name |
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Primary key for the customer |
| customer_name | VARCHAR(100) | Customer name |
| region_id | INT | Region assigned to the customer |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Primary key for the order |
| customer_id | INT | Customer who placed the order |
| order_status | VARCHAR(20) | Order status, such as completed or cancelled |
| order_amount | DECIMAL(10,2) | Revenue from the order |
| order_date | DATE | Order date |