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.
Schema
🔑idINT
🔗patient_idINT
🔗doctor_idINT
visit_dateTEXT
diagnosisTEXT
notesTEXTNULL
follow_up_dateTEXTNULL
statusTEXT
postgresql
Run your query to see results
Press Ctrl + Enter to execute