Your question is Common Pre-Churn User Paths. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a table of user events, how do you identify the most common path a user takes before churning at Superhuman?
Use the provided user and event data. Treat a user's path as all non-null events occurring before that user's churn timestamp, ordered chronologically.
path and churned_users, representing the event sequence and number of churned users following it.churned_users descending, then path ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Superhuman user identifier |
| VARCHAR(255) | User email address | |
| churned_at | TIMESTAMP | Timestamp when the user churned, or NULL for active users |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| user_id | INT | User associated with the event |
| event_name | VARCHAR(100) | Name of the event recorded in Superhuman |
| event_timestamp | TIMESTAMP | Time when the event occurred |