You're analyzing the launch of Vela Stream, a subscription video service. The marketing team wants to compare the behavior of viewers whose subscriptions were activated on different days, weeks, and months, so you need to assign each subscriber to three calendar cohorts.
The subscriptions table stores the subscription activation timestamp. Each subscriber has one row in this table, and subscriber_id is the primary key. For weekly cohorts, the week starts on Monday. For monthly cohorts, use the first day of the calendar month. Exclude rows where activated_at IS NULL.
For each subscriber with a known activation time, determine:
- the activation date;
- the Monday of the activation week;
- the first day of the activation month.
Return these columns:
- subscriber_id;
- cohort_day;
- cohort_week;
- cohort_month.
All three cohort columns must be of the date type and display dates as YYYY-MM-DD. Sort the result by subscriber_id in ascending order. Return exactly one row per subscriber.
subscriber_idcohort_daycohort_weekcohort_monthShowing the first 3 rows of the sample — the full sample comes with Premium
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in