Write a SQL query to find the monthly retention rate of subscribers who purchased a Peloton Bike versus those who joined via the app.
Use the subscribers and subscriber_activity tables. Treat a subscriber as retained in a month when they have at least one activity record during that calendar month after joining. Include the acquisition cohort and compare the two acquisition groups.
subscriber_segment, cohort_month, activity_month, cohort_subscribers, retained_subscribers, and retention_rate.| Column | Type | Description |
|---|---|---|
| subscriber_idPK | INT | Unique subscriber identifier |
| joined_at | DATE | Date the subscriber joined Peloton |
| acquisition_source | VARCHAR(30) | Subscriber acquisition path, such as Bike Purchase or App |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity record identifier |
| subscriber_id | INT | Subscriber associated with the activity |
| activity_date | DATE | Date of subscriber activity |