5. Desktop vs Mobile Sessions

Easy

sessions(session_id, user_id, device_type, started_at)

For September 2026, return a single row with desktop_sessions and mobile_sessions. Treat 'tablet' as mobile; any other device type counts as neither.

One row with two columns, so this is conditional aggregation over the whole table rather than a GROUP BY device_type.

Tables

sessions

session_id  user_id  device_type  started_at
----------  -------  -----------  -------------------
1           1        desktop      2026-09-01 00:00:00
2           2        mobile       2026-09-15 12:00:00
3           3        tablet       2026-09-20 12:00:00
4           4        desktop      2026-09-30 23:59:59
5           5        tv           2026-09-10 12:00:00
6           6        desktop      2026-08-31 23:59:59
7           7        mobile       2026-10-01 00:00:00
8           8        mobile       2026-09-05 12:00:00

Expected result

desktop_sessions  mobile_sessions
----------------  ---------------
2                 3

Sign in to write and run your own code.

Write one SELECT query