Break the problem into three parts: identify today's active users in Great Britain from the user daily status table, compute the number of calls made or received by each user in the previous 7 days (excluding today) from the calls table, and then calculate the percentage of active GB users who had more than 50 calls in that period. Use a left join or subquery to combine the two datasets, ensuring that users with zero calls are included in the denominator.
Pro tip: Clarify the definition of 'active user' and 'made or received' (e.g., whether a call counts if the user is either caller or receiver) and confirm the date boundaries (previous 7 days excluding today) to avoid off-by-one errors. Also, consider using a CTE for readability and performance.
Filter the user daily status table for today's date and country = 'Great Britain' to get the set of active users. This forms the denominator.
From the calls table, filter calls where the call date is between today-7 and yesterday (inclusive), and count calls where the user is either the caller or the receiver. Group by user ID.
Left join the active users with the call counts on user ID, so that users with no calls get a count of 0. Then filter for users with call count > 50.
Compute the ratio of the number of active users with >50 calls to the total number of active users, multiplied by 100 to get a percentage.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.