Day-7 Retention by Signup Cohort and Acquisition Channel

Last updated: November 29, 2026

Quick Overview

Using a users table with signup date and acquisition channel and an app_opens table, compute day-7 retention for each daily signup cohort split by channel, excluding cohorts whose day 7 has not happened yet.

TikTok
Data Manipulation (SQL/Python)
Data Scientist
TikTok
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Using a users table with signup date and acquisition channel and an app_opens table, compute day-7 retention for each daily signup cohort split by channel, excluding cohorts whose day 7 has not happened yet.

TikTok's growth team watches early retention by install source (organic, paid social, app store search, referral programs) to judge whether paid installs are worth the spend. The interviewer checks the retention definition, the LEFT JOIN that keeps non-retained users in the denominator, and the cohort maturity filter.

What the Interviewer Expects
  • State a precise day-7 definition (exactly day 7 versus within days 1 to 7)
  • Use a LEFT JOIN so non-retained users stay in the denominator
  • Deduplicate multiple opens on the same day
  • Exclude immature cohorts whose day 7 is not complete
  • Discuss small cohorts and how to read noisy channel splits
Key Topics to Cover
cohort retention
LEFT JOIN
cohort maturity
acquisition channel
denominators
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you change the query for rolling retention (any open on day 7 or later)?
  • How would you produce the full D1, D7, D30 curve in one pass?
  • Paid retention is lower than organic. Is that a channel problem or a mix problem?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data
  • users(user_id, signup_date, acquisition_channel), one row per user.
  • app_opens(user_id, open_date), possibly many rows per user per day.
  • Definition: a user is D7 retained if they opened t...
Approach
  1. Collapse opens to distinct (user_id, open_date) to avoid multiplying rows.
  2. LEFT JOIN users to opens on open_date = signup_date + 7. Users with no match produce NULL and count in the denomina...

Submit Your Answer
Markdown supported

Related Questions