Your question is Top 10 Spenders SQL. Start with the requirements and the one table 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.
Scopely wants to identify the highest-spending players in MONOPOLY GO! for a player monetization review. Write a SQL query that calculates each player's total positive purchase amount and returns the top 10 players.
Include only purchase records with a strictly positive amount_usd. A player may have multiple purchase records, and players with no qualifying purchases should not appear.
player_id, player_name, and total_spenttotal_spent is the player's total qualifying purchase amounttotal_spent from highest to lowestplayer_id in ascending order| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique identifier for the purchase record |
| player_id | VARCHAR(20) | Unique identifier for the player |
| player_name | VARCHAR(100) | Display name of the player |
| amount_usd | DECIMAL(10,2) | Purchase amount in US dollars; negative values represent refunds |