Daily Users Active on Both Facebook and Instagram via Linked Accounts
Last updated: November 29, 2026
Quick Overview
Facebook and Instagram activity is logged under separate account ids, and Accounts Center links them to a person, sometimes with several Instagram accounts per person. Count, per day, the distinct people active on both apps and on exactly one.
Meta
November 29, 20260
0
0 solved
Facebook and Instagram activity is logged under separate account ids, and Accounts Center links them to a person, sometimes with several Instagram accounts per person. Count, per day, the distinct people active on both apps and on exactly one.
Cross-app reach is a core family-of-apps metric at Meta, and the identity layer is many-to-many. The interviewer checks mapping account ids to a person id, deduping people with multiple accounts, and treating unlinked accounts sensibly.
What the Interviewer Expects
- Maps each app's account ids to a person id through the link table
- Treats unlinked accounts as their own person
- Dedupes to (day, person, app) before combining
- Uses a FULL OUTER JOIN or conditional aggregation to classify both vs one app
- Mentions links that start and end over time
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you account for links created partway through the window?
- Why might the both-apps share be understated?
- How would you extend this to Messenger, WhatsApp, and Threads?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
fb_activity(fb_account_id, activity_date) and ig_activity(ig_account_id, activity_date), many rows per account per day. account_links(person_id, app, account_id, linked_at, unlinked_at). A perso...
Approach
- Map each activity row to a person id with a LEFT JOIN on the link table, valid at the activity date; if no link, synthesize an id like
'fb:' || account_id. - Union both apps into (day, person, a...