Skip to main content
All Problems
hard0% acceptance

Rank Accounts by Balance Within Type

The analytics team wants to rank accounts by balance within each account type. Return account id, account_type, balance, and a rank column. Use RANK() partitioned by account_type, ordered by balance descending.

Schema

🔑idINT
🔗customer_idINT
account_typeTEXT
balanceREAL
currencyTEXT
opened_atTEXT
statusTEXT
postgresql

Run your query to see results

Press Ctrl + Enter to execute