Chapter 8 · Window Functions
35. Highest Balance Account per Type
Hard40 XPFinance
For each active account, show the highest balance within that account type using FIRST_VALUE. Return account_type, id, balance, and type_max_balance. Sort by account_type, balance DESC.
Tables
- PKidINT
- FKcustomer_id→ customers.idINT
- account_typeTEXT
- balanceREAL
- currencyTEXT
- opened_atTEXT
- statusTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.