Write a SQL query to analyze user retention over time using a transactions or activity table.
Calculate retention by signup month and the number of months since signup. Include users with no qualifying activity when determining each cohort's size.
cohort_month, months_since_signup, retained_users, cohort_users, and retention_ratecohort_month and months_since_signup ascending, and report retention as a decimal rounded to four places| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| signup_date | DATE | Date the user registered |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity record identifier |
| user_id | INT | User associated with the activity |
| activity_date | DATE | Date of user activity |