Interview Guides
BrightCart wants to compare user retention across acquisition channels. Write a SQL query to calculate day-30 retention by acquisition channel for users who signed up in January 2024.
A user is considered retained if they have at least one session on or after 30 days from signup and before 60 days from signup.
users table.signup_date is between 2024-01-01 and 2024-01-31.users| column | type | description |
|---|---|---|
| user_id | INT | Primary key for each user |
| signup_date | DATE | Date the user created an account |
| acquisition_channel | VARCHAR(50) | Marketing channel attributed at signup |
| country_code | VARCHAR(2) | User country |
sessions| column | type | description |
|---|---|---|
| session_id | INT | Primary key for each session |
| user_id | INT | User who started the session |
| session_date | DATE | Date of the session |
| device_type | VARCHAR(20) | Device used for the session |