Straightforward join but I second-guessed whether to use the caller or recipient column to count a user as having 'made' a call.
Start by clarifying the definitions of 'based in France' (e.g., user's country field) and 'made at least one video call' (e.g., call initiated or received). Then write a SQL query that filters users by country, joins to video calls on the previous day, and computes the percentage of distinct users who made at least one call.
Pro tip: Mention that you would check for data quality issues like null country values or timezone handling, and consider whether 'previous day' should be based on UTC or user's local time. This shows attention to detail and real-world data challenges.
Confirm what 'based in France' means (e.g., users.country = 'France') and what constitutes a 'video call' (e.g., call_type = 'video' and status = 'completed'). Also define 'previous day' relative to the current date or a given date.
Use users table for user_id and country, and video_calls table for caller_id, receiver_id, call_date, and call_type. Determine if a call is attributed to the caller, receiver, or both.
Select distinct user_ids from users where country = 'France'. This gives the denominator: all users based in France.
Select distinct caller_id from video_calls where call_date = previous_day and call_type = 'video'. Join with the eligible users to ensure only French users are counted.
Divide the count of distinct users who made at least one call by the total count of French users, multiply by 100, and round as needed.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Filtered on dau_flag = 1 and country = 'US', summed duration, divided by distinct DAU count.
Clarify the definitions of 'video calls', 'daily active user', and 'time spent' to ensure alignment with Meta's product metrics. Then, write a SQL query that joins call session data with user activity data, filters for US users and today's date, and computes the average time per DAU. Consider edge cases like multiple calls per user and time zone handling.
Pro tip: Always state your assumptions about definitions (e.g., what counts as a video call, how to handle users with zero calls) and mention that you would validate with product managers. This shows you understand the business context and avoid misalignment.
Define 'video call' (e.g., 1:1 or group, minimum duration), 'daily active user' (e.g., logged in and performed any action), and 'time spent' (e.g., total call duration per user). Assume today's date and US filter based on user country.
Assume tables: call_sessions (call_id, user_id, start_time, end_time, call_type) and user_activity (user_id, date, country, is_active). Ensure you have a way to link calls to users and filter by date and country.
For each user, sum the duration of all video calls that occurred today. Use TIMESTAMPDIFF or DATEDIFF to calculate duration in seconds/minutes. Handle calls that span midnight by clipping to today's date.
Filter user_activity for today's date and country = 'US' to get the set of DAU. Ensure you only include users who were active today.
Join the total call time per user with the DAU list, ensuring all DAU are included (left join). Compute the average of total call time per user, treating users with no calls as 0. Divide total call time by number of DAU.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.