Chapter 6 · Subqueries
16. Customers with Multiple Account Types
Medium20 XPFinance
The cross-selling team wants to find customers who have more than one type of account (e.g., both checking and savings). Return customer_id, first_name, last_name, and the number of distinct account types they hold. Sort by the 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.