Share of New Threads Users Following Five Accounts in a Week

Last updated: November 29, 2026

Quick Overview

Write SQL that, for each weekly signup cohort on Threads, returns the number of new users and the share who followed at least five distinct accounts within seven days of signing up.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Phone Screen
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Write SQL that, for each weekly signup cohort on Threads, returns the number of new users and the share who followed at least five distinct accounts within seven days of signing up.

Early follow counts are a standard activation signal for social apps like Threads, where an empty feed predicts churn. This phone-screen style question checks cohort grouping, a per-user window relative to signup, LEFT JOIN to keep zero-follow users, and DISTINCT on re-follows.

What the Interviewer Expects
  • Groups users into signup week cohorts
  • Counts follows in a window relative to each user's own signup time
  • Keeps users with zero follows
  • Uses COUNT DISTINCT to ignore repeated follow events
  • Excludes cohorts whose window is incomplete
Key Topics to Cover
Activation metrics
Cohort analysis
LEFT JOIN
COUNT DISTINCT
Time windows
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 should unfollows within the week be handled?
  • How would you show the full distribution of follow counts?
  • How would you test whether reaching five follows causes better retention?
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

Tables: users(user_id, signup_at) and follows(follower_id, followee_id, followed_at). A user may follow, unfollow, and re-follow the same account, producing repeated rows; I will count distinct fo...

Approach

For each user, count distinct followees with followed_at in [signup,signup+7d)[\text{signup}, \text{signup} + 7\text{d}). LEFT JOIN so users with no follows get 0. Then group by cohort week and average a 0/1 indica...


Submit Your Answer
Markdown supported