Menu
hardMaybank · windowBasic

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
idINT
nameTEXT
transactions
idINT
customer_idINT
amountNUMERIC(10,2)

Basic

The example input, expected output, and walkthrough for this question unlock with a Basic plan.

↑ Read the question

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.

See Basic plans

RM 25/mo · cancel anytime

Keep going

Company names are trademarks of their respective owners, used here only to describe practice material. mahir_data is not affiliated with, endorsed by, or sponsored by any company named on this site. Terms.