A marketing team wants to compare how effectively acquisition channels drive early customer engagement. Using customer acquisition records and subsequent activity events, calculate 30-day retention for each acquisition-date and channel cohort.
Assume a customer is retained when they generate at least one activity event strictly after acquisition and before 30 days have elapsed. Include cohorts with zero retained customers, and label missing acquisition channels as Unknown.
LEFT JOIN so cohorts with no retained customers remain in the output.acquisition_channel, acquisition_date, cohort_size, retained_customers, retention_rate.acquisition_channel ascending, then acquisition_date ascending.retention_rate to four decimal places.NULL for retention_rate when cohort_size is zero.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| acquired_at | TIMESTAMPTZ | Timestamp when the customer was acquired |
| acquisition_channel | VARCHAR(50) | Marketing channel credited with acquisition |
| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique activity event identifier |
| customer_id | INTEGER | Customer associated with the event |
| event_at | TIMESTAMPTZ | Timestamp when the activity occurred |
| event_type | VARCHAR(50) | Type of customer activity |