Write a SQL query to calculate the month-over-month retention rate of users acquired through paid search at Gusto. Treat a user as retained when they have at least one product activity event in the calendar month immediately after their acquisition month. Use the provided tables and return one row per acquisition month, including months with no retained users.
acquisition_month, cohort_users, retained_users, and retention_rateretention_rate is retained users divided by cohort usersacquisition_month ascending| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Gusto user identifier |
| signup_date | DATE | Date the user signed up |
| Column | Type | Description |
|---|---|---|
| attribution_idPK | INT | Unique attribution record identifier |
| user_id | INT | Attributed user identifier |
| source | VARCHAR(50) | Marketing acquisition source |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity event identifier |
| user_id | INT | User who generated the activity |
| activity_date | DATE | Date of product activity |
| activity_type | VARCHAR(50) | Type of product activity |