Your question is Top Spenders Query. 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.
Ubisoft wants to identify the highest-spending players across its live games during a reporting period. Write a PostgreSQL query that ranks player spending and returns the top 5% based on purchases made from 2025-01-01 through 2025-03-31.
player_id, gamer_tag, and total_spent, ordered by spending descending and player ID ascending for deterministic results.| Column | Type | Description |
|---|---|---|
| player_idPK | INT | Unique player identifier |
| gamer_tag | VARCHAR(50) | Player display name |
| platform | VARCHAR(20) | Gaming platform |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| player_id | INT | Purchasing player identifier |
| purchased_at | TIMESTAMP | Purchase timestamp |
| amount | NUMERIC(10,2) | Purchase amount in USD |
| game_title | VARCHAR(80) | Ubisoft game associated with the purchase |