Device Type Viewership Split
Problem
**[Asked at The New York Times]**
The NYT tracks article views by device type. Calculate the **total views** for:
- **Laptop** devices
- **Mobile** devices (tablet + phone combined)
Return both numbers in a single row as `laptop_views` and `mobile_views`.
Tables
Example rows — the live problem includes the full dataset.
article_views
| view_id | user_id | device_type | -- | 'tablet' | 'phone' |
|---|
Expected output
Your answer should return 1 row with the columns laptop_views, mobile_views.
Starter code (SQL)
SELECT *
FROM article_views;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