001Level 1

Chapter 4 · Aggregations

67. Patients with More Than 3 Visits

Medium20 XPHealthcare

Care management wants to identify frequent visitors. Find patients who have had more than 3 visits. Return patient first_name, last_name, and visit_count. Order by visit_count descending.

Tables

  • PKidINT
  • first_nameTEXT
  • last_nameTEXT
  • date_of_birthTEXT
  • genderTEXT
  • emailTEXT
  • phoneTEXT
  • blood_typeTEXT
  • cityTEXT
  • stateTEXT
  • FKinsurance_id→ insurance.idINT
  • created_atTIMESTAMP
  • PKidINT
  • FKpatient_id→ patients.idINT
  • FKdoctor_id→ doctors.idINT
  • visit_dateTEXT
  • diagnosisTEXT
  • notesTEXT
  • follow_up_dateTEXT
  • 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 4 · Aggregations

0/74
  1. 1Total Number of Orders
  2. 2Total Revenue by Category
  3. 3Average Order Value
  4. 4Orders Per Customer
  5. 5Highest and Lowest Priced Products
  6. 6Count Customers per State
  7. 7Average Order Value by Status
  8. 8Customers with Multiple Orders
  9. 9Payment Method Distribution
  10. 10Monthly Order Volume
  11. 11Top 10 Spending Customers
  12. 12Count Delivered Orders
  13. 13Count Orders by Status Category
  14. 14Total Discount Amount Per Order
  15. 15Total Number of Accounts
  16. 16Total Balance by Account Type
  17. 17Average Loan Principal
  18. 18Transactions Per Account
  19. 19Minimum and Maximum Loan Interest Rates
  20. 20Account Types with Many Accounts
  21. 21Monthly Transaction Volume
  22. 22Average Account Balance by Status
  23. 23Loan Portfolio Status Summary
  24. 24Total Deposits Per Account
  25. 25Count of Accounts Per Branch City
  26. 26Loan Count by Status
  27. 27Total Fees Charged Per Account
  28. 28Count Patients by State
  29. 29Average Doctor Salary by Department
  30. 30Visit Count by Status
  31. 31Total Billing Amount by Status
  32. 32Top 10 Most Prescribed Medications
  33. 33Departments with More Than 4 Doctors
  34. 34Abnormal Lab Result Percentage
  35. 35Min and Max Billing Amounts
  36. 36Count Patients per Blood Type
  37. 37Earliest and Latest Doctor Hire Dates
  38. 38Average Billing Amount by Status
  39. 39Top 5 Most Prescribed Medications
  40. 40Departments on Each Floor
  41. 41Male Patients Grouped by City
  42. 42Doctor Count per Specialty
  43. 43Total Pending Billing Amount
  44. 44Patient Count by Birth Decade
  45. 45Visit Count by Day of Week
  46. 46Categories with Many Products
  47. 47Monthly Order Count
  48. 48Average Rating Per Product
  49. 49Average Shipping Duration by Carrier
  50. 50Revenue Impact of Discounts
  51. 51Order Count and Average by Status
  52. 52Top 5 Customers by Total Spend
  53. 53Monthly Revenue Summary
  54. 54Product Statistics per Category
  55. 55Payment Method Breakdown
  56. 56Total Revenue Per Customer with Name
  57. 57Product Rating Breakdown with CASE
  58. 58Customer Count by Age Group
  59. 59Deposit Volume by Day of Week
  60. 60Average Loan Principal by Loan Type
  61. 61Monthly Transaction Count and Volume
  62. 62Branch with the Most Customer Accounts
  63. 63Interest Collected per Loan Type
  64. 64Monthly Deposit and Withdrawal Totals
  65. 65Customers Holding Multiple Account Types
  66. 66Visit Count by Month and Year
  67. 67Patients with More Than 3 Visits
  68. 68Patients Who Saw Multiple Doctors
  69. 69All Medications per Patient (Comma-Separated)
  70. 70High-Volume High-Revenue Doctors
  71. 71Patients with Visits in Multiple Months
  72. 72Abnormal Result Rate by Lab Test
  73. 73Portfolio Diversification Score
  74. 74Patients with All Visit Status Types
See the full learning path →