Compare average account balances across branch cities. Join customers to accounts using customer_id, then group by the customer's city. Return city, the number of accounts (num_accounts), and the average balance (avg_balance, rounded to 2 decimals). Only include cities with at least 3 accounts. Order by avg_balance descending.
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