Skip to main content
All Problems
hard0% acceptance

Dense Rank Customers by Total Balance

Rank customers by their total account balance using DENSE_RANK. First compute the total balance across all active accounts per customer, then assign a dense rank. Return first_name, last_name, total_balance, and balance_rank. Show top 20 by rank.

Schema

🔑idINT
first_nameTEXT
last_nameTEXT
emailTEXT
phoneTEXTNULL
date_of_birthTEXT
cityTEXT
stateTEXT
countryTEXT
created_atTIMESTAMP
postgresql

Run your query to see results

Press Ctrl + Enter to execute