International Call Percentage
Twilio ☯️ Medium SQL
Beginner Mode

Objective

Write a SQL query to calculate the percentage of phone calls that are international.

Table Schema:

  • phone_calls
Column Type Description
caller_id INTEGER ID of the caller
receiver_id INTEGER ID of the receiver
  • phone_info
Column Type Description
caller_id INTEGER ID of the phone user
country_id INTEGER Country of the phone user

Task Requirements:

  • A call is international if the caller and receiver are in different countries
  • Look up the country for both the caller and the receiver using the phone_info table
  • Calculate the percentage of international calls out of total calls
  • Round the result to 1 decimal place

Output columns: international_pct

Examples

Example 1:

Input:

phone_calls
caller_idreceiver_id
12
13
34
25
51
43
31
phone_info
caller_idcountry_id
11
21
32
42
53

Output:
international_pct
57.1
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 →