hardMaybank · windowPro
Rank customers by spend
Maybank wants a leaderboard of its biggest spenders.
Join customers to transactions and return each customer's name, their total spend as total_spent, and their rank as spending_rank where 1 is the highest spender (rank by total spend, highest first). Assume no two customers have the same total.
Schema
▸customers
| id | INT |
| name | TEXT |
▸transactions
| id | INT |
| customer_id | INT |
| amount | NUMERIC(10,2) |
Pro
The example input, expected output, and walkthrough for this question unlock with a Pro plan.
Pro
This is a Pro question
Premium practice questions unlock with a Pro plan. The full solution, expected output, and grading are available to Pro members.