Premium problem43. International Call Share

Medium Locked

phone_calls(call_id, caller_id, receiver_id, started_at) and users(user_id, country_code)

For September 2026, return international_call_pct: the percentage of calls where the caller and receiver are in different countries, rounded to two decimals.

A call is only counted when both parties are known, so joining users twice also filters out calls involving somebody who is not in the table.

Tables

phone_calls

call_id  caller_id  receiver_id  started_at
-------  ---------  -----------  -------------------
1        1          2            2026-09-01 10:00:00
2        1          3            2026-09-02 10:00:00
3        3          4            2026-09-03 10:00:00
4        1          99           2026-09-04 10:00:00
5        1          3            2026-08-31 10:00:00

users

user_id  country_code
-------  ------------
1        US
2        US
3        IN
4        GB

Expected result

international_call_pct
----------------------
66.67

Premium problem

This one's part of Premium. Unlock the full MySQL track plus every other premium problem on the site.

Write one SELECT query