Chapter 6 · Subqueries
50. Accounts Opened Before Their City Got a Branch
Hard40 XPFinance
Find accounts belonging to customers whose account was opened before any branch in the customer's city was established. Return customer first_name, last_name, account opened_at, and branch opened_at. Sort by account opened_at.
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
- PKidINT
- nameTEXT
- cityTEXT
- stateTEXT
- manager_nameTEXT
- opened_atTEXT
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.