Write a query to find the top 10% of GameStop customers based on their spend in the last 6 months.
Use completed orders only and treat CURRENT_DATE as the end of the reporting period. Include all customers in the ranking population, including customers with no qualifying spend.
customer_id, customer_name, total_spend, and spend_rank.total_spend descending, then customer_id ascending. Ties should share the same rank.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique GameStop customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer associated with the order |
| order_date | DATE | Date the order was placed |
| order_amount | NUMERIC(10,2) | Total monetary amount of the order |
| order_status | VARCHAR(20) | Order lifecycle status |