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
| id | INT |
| name | TEXT |
| id | INT |
| customer_id | INT |
| amount | NUMERIC(10,2) |
Basic
The example input, expected output, and walkthrough for this question unlock with a Basic plan.
Basic
The reference solution and walkthrough for this question unlock with a Basic plan.
Basic
This is a Basic question
Premium practice questions unlock with a Basic plan. The full solution, expected output, and grading are available to Basic members.
RM 25/mo · cancel anytime