This question evaluates a candidate's ability to perform SQL-based data manipulation and analytics, testing skills such as aggregations, joins to user metadata, percentage/rate calculations, and distinct-count reasoning over call records.
You are given two tables.
Table: calls
call_id
BIGINT
sender_id
BIGINT
receiver_id
BIGINT
call_ts
TIMESTAMP — stored in UTC
pickup
CHAR(1) —
'Y'
if the call was picked up,
'N'
otherwise
call_type
VARCHAR — either
'video'
or
'voice'
Assume each row represents one call attempt.
Table: users
user_id
BIGINT
country
VARCHAR
Assume calls.sender_id = users.user_id when you need the caller's country. Unless otherwise stated, compute results over the full available dataset.
Write SQL for the following:
call_type
.
call_type
,
total_calls
,
picked_up_calls
country
,
pickup_rate_pct
pickup_rate_pct
as
100.0 * picked_up_calls / total_calls
video
call and at least one
voice
call.
sender_id
values in
calls
pct_callers_both_types