Analyze device usage from JSON

Return device and event count, ordered by device.

Try it yourself

Open a fresh temporary product analytics dataset. Write your query and use Check answer. Checking uses a separate, clean sample so edits to your workspace cannot change the expected answer. Matches are based on this dataset, not a proof for every possible database.

Open exercise →

Sample schema

users(id, country, signed_up)
events(id, user_id, event_name, occurred_at, properties)

About this dataset · Learning paths · SQL reference

Show a hint

Extract $.device from properties before grouping.

Show one solution
SELECT json_extract(properties,'$.device') AS device,COUNT(*) FROM events GROUP BY device ORDER BY device;

Other queries can produce the same answer. Column aliases are ignored; column order and row order are checked.

Keep practicing

Find inactive users → · All exercises