Can you add up unique user counts across groups?

The subquery counts unique users for each event type separately. The outer query adds those counts together and compares the sum with the number of unique users in the entire table. What two numbers will the query return?

Predict the resultGROUP BY / HAVINGMiddleAnalystData Engineer
Input data · iv_events
iduser_idevent_typecreated_at
11login2026-01-31 23:59:00
21login2026-01-31 23:59:00
31view2026-02-01 00:00:00
42login2026-02-01 08:00:00
52view2026-02-01 08:05:00
62view2026-02-01 08:05:00
73login2026-02-02 10:00:00
8NULLview2026-02-03 11:00:00
91purchase2026-02-03 12:00:00
102logout2026-02-28 23:59:59

Query

SELECT SUM(users) AS sum_by_type,
       (SELECT COUNT(DISTINCT user_id) FROM iv_events) AS all_users
FROM (
  SELECT event_type, COUNT(DISTINCT user_id) AS users
  FROM iv_events
  GROUP BY event_type
) t