Write a SQL query to find the month-over-month retention rate of users across our digital properties.
Use the users and user_activity tables. A user is active in a month when they have at least one activity event for a property. Calculate retention separately for each property and month, excluding months without an active prior month.
property_name, activity_month, current_month_users, retained_users, prior_month_users, and retention_rateretention_rate is retained users divided by prior-month usersproperty_name, then activity_month ascending| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| VARCHAR(255) | User email address | |
| created_at | DATE | Date the user account was created |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity event identifier |
| user_id | INT | User associated with the activity event |
| property_name | VARCHAR(100) | Red Ventures digital property where activity occurred |
| activity_at | TIMESTAMP | Timestamp of the activity event |