Amazon DSP needs a customer-level view of purchase activity to prioritize audience analysis and optimization. Write a PostgreSQL query to find the 10 customers with the highest completed purchase volume.
quantity from items belonging to orders with status = 'completed'.customer_id ascending to break ties.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| customer_id | INT | Customer who placed the order; NULL for unattributed orders |
| status | VARCHAR(20) | Order lifecycle status |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Order associated with the item record |
| quantity | INT | Number of units in the order item |