Session Duration by Platform
Problem
**[Asked at Google]**
Google tracks user sessions across devices. Each session has a start and end time.
Calculate the **average session length in minutes** per platform, rounded to 2 dp.
Return `platform` and `avg_duration_min`, ordered by platform.
Tables
Example rows — the live problem includes the full dataset.
user_sessions
| session_id | user_id | platform | start_time | end_time |
|---|
Expected output
Your answer should return 3 rows with the columns platform, avg_duration_min.
Starter code (SQL)
SELECT *
FROM user_sessions;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock