HARDVerified Real Interview• Product Data Scientist

Weekly Signup Retention Cohort Curves

Meta's Growth leadership tracks user retention curves across weekly signup cohorts.

Write a SQL query to calculate Day-7 Retention Rate for each weekly cohort. A user signed up on date $D$ is defined as retained on Day-7 if they logged at least one activity between day $D+1$ and day $D+7$. Return the cohort_week (formatted as 'YYYY-MM-DD' representing the start of the week), new_users_count, retained_users_count, and retention_rate_pct rounded to 1 decimal place. Sort by cohort_week ascending.

Tables:

  • users (user_id INT, signup_date DATE)
  • user_activity (user_id INT, activity_date DATE)

Execution Sandbox:

Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.

Standard SQL (ANSI)|Ln 1, Col 1
⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.