voice_sessions has one row per call (user_id, call_id, is_international) where is_international is 1 for an international call and 0 otherwise. For each user, compute the percentage of their calls that were international. Output columns: user_id, international_pct (rounded to 2 decimals). Order by user_id ascending.
| Column | Type |
|---|---|
| user_id | INTEGER |
| call_id | INTEGER |
| is_international | BOOLEAN |
| user_id | call_id | is_international |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 2 | 0 |
| 1 | 3 | 1 |
| 2 | 4 | 0 |
| 2 | 5 | 0 |
| 3 | 6 | 1 |
| user_id | international_pct |
|---|---|
| 1 | 66.67 |
| 2 | 0 |
| 3 | 100 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.