Back to Practice
#0140

Users With No Events

EasySQL15 min10 XP

Problem

Return user_id and name for users with no events.

Why This Matters

Anti-joins are critical for churn, inactive users, missing records, and data-quality checks.

Schema

users(user_id INTEGER, name TEXT); events(event_id INTEGER, user_id INTEGER)

Examples

Example 1
Inputusers 1,2 and only user 1 has an event
Outputuser 2

The left join creates NULL event columns for users with no match.

Constraints

  • Return the exact requested structure.
  • Handle normal edge cases cleanly.
  • Prefer readable code over clever shortcuts.
CodeSQL
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
Inputusers 1,2 and only user 1 has an event
Expecteduser 2

The left join creates NULL event columns for users with no match.

Hidden Test Categories
all users activemultiple events per userno events table rows