001Level 1

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.

Peek at the solution?

You can still earn the XP afterwards by submitting a working query — but you'll learn more if you give it one more try.

Chapter 6 · Subqueries

0/54
  1. 1Products Above Average Price
  2. 2Customers Who Never Left a Review
  3. 3Customers Without Any Loans
  4. 4Products Priced Above Average
  5. 5High-Spending Customers
  6. 6Most Expensive Product Per Category
  7. 7Orders with the Most Line Items
  8. 8Payment Status by Method
  9. 9Above-Average Price List
  10. 10Customers Who Have Never Placed an Order
  11. 11Most Expensive Product in Each Category
  12. 12Orders Exceeding Customer's Own Average
  13. 13Products with No Reviews
  14. 14Customers Spending Above Average
  15. 15Accounts with Above-Average Balance
  16. 16Customers with Multiple Account Types
  17. 17Largest Transaction Per Account
  18. 18Customers with Defaulted Loans
  19. 19Accounts with No Transactions
  20. 20Loans Above Their Type Average
  21. 21Largest Account Balance Per Customer
  22. 22Accounts Opened on the Same Day as Another
  23. 23Account Balance Change Since Opening
  24. 24Transactions Above Account Type Average
  25. 25Accounts with Balance Above Overall Average
  26. 26Customers Who Have Multiple Active Loans
  27. 27Highest Single Transaction per Customer
  28. 28Loans with Interest Rate Above Their Type Average
  29. 29Accounts with Above-Average Transaction Volume
  30. 30Largest Withdrawal Per Customer
  31. 31Dormant Accounts (No Recent Transactions)
  32. 32Account Type Balance Share
  33. 33Each Customer's First Transaction
  34. 34Doctors Earning Above Average
  35. 35Patients Who Have Never Visited
  36. 36Highest Single Bill per Department
  37. 37Patients with Multiple Different Diagnoses
  38. 38Doctors Earning Above Department Average
  39. 39Diagnosis Frequency as Percentage
  40. 40Patients Who Have At Least One Prescription
  41. 41Most Expensive Visit per Patient
  42. 42Departments with Above-Average Doctor Count
  43. 43Visits Without Any Prescriptions (NOT EXISTS)
  44. 44Patients Who Have Never Had a Prescription
  45. 45Most Common Diagnosis per Department
  46. 46Customers Who Bought from 10+ Categories
  47. 47Products Ordered but Never Reviewed
  48. 48Orders Above Customer's Own Average
  49. 49Customers Who Bought from 13+ Categories
  50. 50Accounts Opened Before Their City Got a Branch
  51. 51Customers with Every Account Type
  52. 52Visits Billed Above Department Average
  53. 53Doctors Who Have Every Visit Status
  54. 54Visits with Above-Average Billing for Their Doctor
See the full learning path →