✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
You have a table orders:
| column | type |
|---|---|
order_id | INT (PK) |
customer_id | INT |
order_date | DATE |
amount | DECIMAL(10,2) |
Write an SQL query to calculate the total spend per customer and rank customers by total spend (highest spender = rank 1)Example result:
| customer_id | total_spend | rank_in_all_customers |
|---|---|---|
| 201 | 1200 | 1 |
| 105 | 950 | 2 |
| 309 | 700 | 3 |
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!