This question evaluates SQL data manipulation and analytical competencies, including aggregation, joins between user and event tables, time-window filtering, deduplication for unique users, and computation of counts and pickup rates.
Assume you are given two tables.
Table: calls
call_id
BIGINT
sender_id
BIGINT
receiver_id
BIGINT
call_time
TIMESTAMP
pickup
VARCHAR -- values: 'Y' or 'N'
call_type
VARCHAR -- values: 'video' or 'voice'
Table: users
user_id
BIGINT
country
VARCHAR
Assume:
calls.sender_id
and
calls.receiver_id
both reference
users.user_id
.
CURRENT_DATE
in UTC.
sender_id
.
Write SQL for the following tasks:
call_date
call_type
total_calls
picked_up_calls
pickup_rate
country
total_calls
picked_up_calls
pickup_rate
total_unique_callers
callers_with_both_types
pct_callers_with_both_types