Given this raw dataset of user interactions, write a dplyr pipeline to aggregate the average session length by user cohort at Betterup.
For this PostgreSQL exercise, write the equivalent SQL query using the provided users and user_interactions tables. Include cohorts without recorded interactions, and ignore missing session lengths when calculating averages.
cohort, average_session_length| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique BetterUp user identifier |
| cohort | VARCHAR(7) | User cohort represented as a YYYY-MM value |
| Column | Type | Description |
|---|---|---|
| interaction_idPK | INT | Unique interaction identifier |
| user_id | INT | User associated with the interaction |
| session_length_minutes | INT | Session duration in minutes |