Monthly Long Call Growth Rate
Twilio 🧠 Hard SQL
Beginner Mode

Objective

You are given a table of phone call records. Each row represents a single call with details about the caller, receiver, date, and duration in seconds.

Table Schema:

The phone_calls table:

Column Type Description
caller_id integer ID of the person who made the call
receiver_id integer ID of the person who received the call
call_date date Date of the call
duration_secs integer Duration of the call in seconds

Task Requirements:

  • Filter for calls that last more than 5 minutes (300 seconds)
  • Count the number of qualifying calls per month
  • Calculate the month-over-month growth rate as a percentage
  • Round the growth percentage to 1 decimal place
  • The first month should show NULL for the growth rate since there is no previous month
  • Order the results by year and month in ascending order



Output columns: year, month, growth_pct

Examples

Example 1:

Input:

phone_calls
call_datecaller_idduration_secsreceiver_id
2025-01-0513502
2025-01-1012003
2025-01-1524001
2025-01-2035001
2025-02-0316002
2025-02-0823103
2025-02-1234501
2025-02-1531002
2025-02-2047001
2025-02-2543202
2025-02-2813804
2025-02-1025004
2025-03-0513102
2025-03-1022501
2025-03-1534004
2025-03-2043501
2025-03-2525003
2025-03-2816003

Output:
growth_pctmonthyear
null12025
133.322025
-28.632025
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →