Streaming Cohorts on the Calendar
Streaming Cohorts on the Calendar
You are analyzing the launch of Vela Stream, a subscription video service. Marketing wants to compare viewers activated on different days, weeks, and months, so every subscriber needs three calendar cohort labels.
The subscriptions table stores the subscription activation timestamp. A weekly cohort starts on Monday, and a monthly cohort starts on the first calendar day of the month. Ignore rows where activated_at IS NULL.
For every subscriber with a known activation time, determine:
- the activation day;
- the Monday of the activation week;
- the first day of the activation month.
Return:
- subscriber_id;
- cohort_day;
- cohort_week;
- cohort_month.
All three cohort columns must be dates displayed as YYYY-MM-DD. Sort by subscriber_id ascending. Return exactly one row per subscriber.
Exemplo de resposta esperada
É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.
| subscriber_id | cohort_day | cohort_week | cohort_month |
|---|---|---|---|
| 301 | 2025-12-31 | 2025-12-29 | 2025-12-01 |
| 302 | 2026-01-01 | 2025-12-29 | 2026-01-01 |
| 303 | 2026-01-04 | 2025-12-29 | 2026-01-01 |
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
Entrar