PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Data Manipulation (SQL/Python)/Meta

Write SQL for video-call recipients and FR activity

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to author ANSI-SQL for time-windowed aggregations, distinct recipient counts, tie-breaking sorts, joins with user tables, deduplication of users, and percentage calculations on activity data.

  • Medium
  • Meta
  • Data Manipulation (SQL/Python)
  • Data Scientist

Write SQL for video-call recipients and FR activity

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

Given the schema and samples below, write ANSI‑SQL to answer both questions. Assume dates are stored in UTC. Today is 2025-09-01, so “yesterday” is 2025-08-31 and the “last 7 days” window is 2025-08-25 through 2025-08-31 inclusive (exclude 2025-09-01). Tables - video_calls(date DATE, caller_id STRING, recipient_id STRING, call_id BIGINT, duration_sec INT) - daily_users(date DATE, user_id STRING, country STRING, dau_flag TINYINT) Small ASCII samples (not exhaustive) video_calls | date | caller_id | recipient_id | call_id | duration_sec | |------------|-----------|--------------|---------|--------------| | 2025-08-25 | U1 | U2 | 1 | 300 | | 2025-08-25 | U1 | U3 | 2 | 120 | | 2025-08-25 | U2 | U1 | 3 | 60 | | 2025-08-26 | U1 | U2 | 4 | 200 | | 2025-08-27 | U3 | U4 | 5 | 400 | | 2025-08-27 | U1 | U4 | 6 | 180 | | 2025-08-30 | U5 | U1 | 7 | 240 | | 2025-08-30 | U1 | U5 | 8 | 60 | | 2025-08-31 | U2 | U5 | 9 | 300 | | 2025-08-31 | U4 | U1 | 10 | 100 | | 2025-08-31 | U6 | U6 | 11 | 30 | | 2025-09-01 | U1 | U2 | 12 | 90 | daily_users | date | user_id | country | dau_flag | |------------|---------|---------|----------| | 2025-08-31 | U1 | FR | 1 | | 2025-08-31 | U2 | FR | 1 | | 2025-08-31 | U3 | FR | 0 | | 2025-08-31 | U4 | US | 1 | | 2025-08-31 | U5 | FR | 1 | | 2025-08-31 | U6 | FR | 1 | | 2025-09-01 | U1 | FR | 1 | | 2025-09-01 | U2 | FR | 1 | Q1) Find the top 10 callers by the number of distinct recipients they called in the last 7 days (2025-08-25..2025-08-31). Exclude self‑calls (caller_id = recipient_id). Break ties by total calls in the window, then by caller_id ascending. Return: caller_id, distinct_recipient_count, total_calls. Q2) What percentage of active daily users in France were on at least one call yesterday (2025-08-31), counting users who either called or received? Numerator: distinct users in FR with dau_flag = 1 on 2025-08-31 who appear as caller or recipient in video_calls on 2025-08-31. Denominator: distinct users with dau_flag = 1 and country = 'FR' in daily_users on 2025-08-31. Return: numerator, denominator, pct_active_on_call. Ensure no double‑counting of users who both called and received.

Quick Answer: This question evaluates a candidate's ability to author ANSI-SQL for time-windowed aggregations, distinct recipient counts, tie-breaking sorts, joins with user tables, deduplication of users, and percentage calculations on activity data.

Related Interview Questions

  • Compute ad impression conversion rates - Meta (medium)
  • Count unconnected posts and reactions - Meta (medium)
  • Count heavy callers in 7 days - Meta (medium)
  • Write SQL for call metrics - Meta (medium)
  • Write SQL for multi-account metrics - Meta (medium)
Meta logo
Meta
Oct 13, 2025, 9:49 PM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
56
0

Given the schema and samples below, write ANSI‑SQL to answer both questions. Assume dates are stored in UTC. Today is 2025-09-01, so “yesterday” is 2025-08-31 and the “last 7 days” window is 2025-08-25 through 2025-08-31 inclusive (exclude 2025-09-01).

Tables

  • video_calls(date DATE, caller_id STRING, recipient_id STRING, call_id BIGINT, duration_sec INT)
  • daily_users(date DATE, user_id STRING, country STRING, dau_flag TINYINT)

Small ASCII samples (not exhaustive) video_calls

datecaller_idrecipient_idcall_idduration_sec
2025-08-25U1U21300
2025-08-25U1U32120
2025-08-25U2U1360
2025-08-26U1U24200
2025-08-27U3U45400
2025-08-27U1U46180
2025-08-30U5U17240
2025-08-30U1U5860
2025-08-31U2U59300
2025-08-31U4U110100
2025-08-31U6U61130
2025-09-01U1U21290

daily_users

dateuser_idcountrydau_flag
2025-08-31U1FR1
2025-08-31U2FR1
2025-08-31U3FR0
2025-08-31U4US1
2025-08-31U5FR1
2025-08-31U6FR1
2025-09-01U1FR1
2025-09-01U2FR1

Q1) Find the top 10 callers by the number of distinct recipients they called in the last 7 days (2025-08-25..2025-08-31). Exclude self‑calls (caller_id = recipient_id). Break ties by total calls in the window, then by caller_id ascending. Return: caller_id, distinct_recipient_count, total_calls.

Q2) What percentage of active daily users in France were on at least one call yesterday (2025-08-31), counting users who either called or received? Numerator: distinct users in FR with dau_flag = 1 on 2025-08-31 who appear as caller or recipient in video_calls on 2025-08-31. Denominator: distinct users with dau_flag = 1 and country = 'FR' in daily_users on 2025-08-31. Return: numerator, denominator, pct_active_on_call. Ensure no double‑counting of users who both called and received.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Meta•More Data Scientist•Meta Data Scientist•Meta Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.