device_sessions has one row per article view (user_id, device_type, view_time). Report the total number of views made on a 'laptop' and the total made on mobile devices, where mobile means device_type 'phone' or 'tablet'. Any other device type is ignored. Output a single row with columns: laptop_views, mobile_views.
| Column | Type |
|---|---|
| user_id | INTEGER |
| device_type | TEXT |
| view_time | TIMESTAMP |
| user_id | device_type | view_time |
|---|---|---|
| 1 | laptop | 2026-01-01 09:00:00 |
| 2 | phone | 2026-01-01 10:00:00 |
| 3 | tablet | 2026-01-02 11:00:00 |
| 4 | laptop | 2026-01-02 12:00:00 |
| laptop_views | mobile_views |
|---|---|
| 2 | 2 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Incomplete Assembly Orders · Gaps Between Community Updates ›
{{ 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.