How many users started a call with more than 3 different people in the last 7 days?
Table name: video_calls
This table has 1 row per unique call. Assume it only includes calls between 2 individuals.
Table name: dim_all_users
Question 1: How many users started a call with more than 3 different people in the last 7 days?
Table: video_calls
callerBIGINT — FB ID of person who made the callrecipientBIGINT — FB ID of person who was calleddsSTRING — date of the callcall_idBIGINT — each call has a unique IDdurationDOUBLE — length of time of call, in seconds
Table: dim_all_users
user_idBIGINT — user’s FB IDage_bucketSTRING — user’s age categorycountrySTRING — country where the user is basedprimary_osSTRING — main device operating systemdau_flagTINYINT — 1 for daily active users, else 0dsSTRING — date of the record
这道题考察的是基于通话明细做用户去重统计。需要从 video_calls 表里找出“发起通话”的用户,也就是 caller,并按用户聚合,统计他们在最近 7 天内曾经通话过的不同 recipient 数量。如果某个用户对应的不同通话对象数量超过 3,就把这个用户计入答案。核心思路通常是先按 ds 限定最近 7 天,再对 caller 和 recipient 做去重计数,最后统计满足阈值的用户数。这个题重点在于理解“started a call”对应 caller 角色,以及“more than 3 different people”意味着要对通话对象做 distinct 去重。