Your question is Top Customers SQL 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.
Google Cloud Marketplace needs a customer leaderboard based on completed orders. Write a PostgreSQL query that identifies the five customers with the greatest completed-order spending.
customer_id, customer_name, and total completed-order value as total_spent.customer_id ascending as a deterministic tie-breaker, and return only five rows.| 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 associated with the order |
| order_status | VARCHAR(20) | Current order status |
| order_total | NUMERIC(10,2) | Order value in USD |