Electronic Arts wants to identify the highest-spending players in each regional market across EA game purchases. Write a PostgreSQL query that calculates each player's total spend and ranks players independently within their region.
player_id.| Column | Type | Description |
|---|---|---|
| player_idPK | INT | Unique player identifier |
| player_tag | VARCHAR(50) | EA player handle |
| region | VARCHAR(30) | Player geographic region |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| player_id | INT | Player associated with the purchase |
| amount | NUMERIC(10,2) | Purchase amount in USD |