Count daily active users

Return date and distinct active user count for each day, ordered by date.

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

Use date(occurred_at) and COUNT(DISTINCT user_id).

Show one solution
SELECT date(occurred_at),COUNT(DISTINCT user_id) FROM events GROUP BY date(occurred_at) ORDER BY date(occurred_at);

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

Keep practicing

Analyze device usage from JSON → · All exercises