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
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Onsite
Data Manipulation (SQL/Python)
Medium

0

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
identity resolution
many-to-many joins
COUNT DISTINCT
conditional aggregation
family of apps
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 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 Problems
Sample 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
  1. 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.
  2. Union both apps into (day, person, a...

Submit Your Answer
Markdown supported