Find inactive users

Return user id and country for users without any events, ordered by user id.

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 a correlated NOT EXISTS query.

Show one solution
SELECT u.id,u.country FROM users u WHERE NOT EXISTS(SELECT 1 FROM events e WHERE e.user_id=u.id) ORDER BY u.id;

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

Keep practicing

Rank event types per country → · All exercises