Katkat

Identify Top 10 Users by Average Call Duration

MetaData Scientist · Onsite

Last updated

This question evaluates SQL-based data manipulation and time-series aggregation skills, specifically computing per-user metrics from timestamped event data such as call durations.

video_calls

call_iduser_idstart_timeend_time
11012023-07-01 09:00:002023-07-01 09:45:00
21022023-07-01 10:15:002023-07-01 10:40:00
31012023-07-02 14:05:002023-07-02 14:25:00
41032023-07-02 15:00:002023-07-02 16:30:00
51022023-07-03 11:20:002023-07-03 12:00:00
Scenario

A video-calling product team wants to know which users had the longest average call duration over the last 7 days.

Question

Write a SQL query that returns the top 10 users by average call duration (in minutes) for calls started in the last 7 days.

Hints

Compute duration as TIMESTAMPDIFF, filter on start_time, use ORDER BY and LIMIT.