Chapter 7 · CTEs
32. Patient Cohort Retention Analysis
Hard40 XPHealthcare
Perform a cohort retention analysis. Group patients by the month of their first visit (cohort_month). For each cohort, count the total patients and how many returned for a second visit within 90 days. Return cohort_month, cohort_size, returned_within_90_days, and retention_rate (percentage, rounded to 1 decimal). Sort by cohort_month.
Tables
- 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.