Two tables log actions taken on mobile and on web. Return the percentage of users who used only mobile, only web, or both platforms. The three percentages must sum to 100. Round each to 2 decimal places, ordered by platform_group.
Schema
mobile_actions
user_idINTEGER
action_typeVARCHAR
action_timestampTIMESTAMP
web_actions
user_idINTEGER
action_typeVARCHAR
action_timestampTIMESTAMP
Target output
Target output
| platform_group | user_pct |
|---|
| both | 40 |
| mobile_only | 20 |
| web_only | 40 |
What this question tests
Tests set logic across two event tables: classifying users into only-mobile, only-web or both, with percentages that must reconcile to exactly 100. It rewards candidates who build one combined user universe first instead of juggling three separate counts that drift apart.
More SQL interview questions