Chapter 6 · Subqueries
25. Accounts with Balance Above Overall Average
Medium20 XPFinance
The wealth management team wants to identify accounts whose balance exceeds the bank-wide average balance. Use a scalar subquery in the WHERE clause. Return account id, customer_id, account_type, and balance. Sort by balance descending. Limit to 30.
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.