Chapter 4 · Aggregations
25. Count of Accounts Per Branch City
Easy10 XPFinance
Management wants to know how many customer accounts exist in each branch city. Since accounts are linked to customers and customers have a city, count the number of accounts grouped by the customer's city. Return city and account_count, ordered by account_count descending.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- phoneTEXT
- date_of_birthTEXT
- cityTEXT
- stateTEXT
- countryTEXT
- created_atTIMESTAMP
- 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.