Your question is SQL Player Ranking by Spend. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
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 |