Reported March 2026
Notion

Country with the Most Events

Reported by candidates from Notion's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Notion OA. Under 2s to a working solution.
Founder's read

The mistake that sinks most first attempts at this Notion OA question is counting users per country instead of events per country. It was reported in March 2026, and it's a short SQL problem with one join, one group, and a tie-break. Easy to rush, easy to botch. You need the country with the most events, ties broken alphabetically, and exactly two columns back: country and event_count. If you blank on the syntax during the live assessment, StealthCoder runs invisibly on your desktop and can hand you the query. Know the shape first and you probably won't need it.

The problem

Given user locations and an event log, return the country associated with the largest number of events.
Count every event. If several countries tie, return the alphabetically smallest country. Return exactly the columns country and event_count.

Tables
users: user_id PK (Integer), country (Text)
events: event_id PK (Integer), user_id (Integer), event_type (Text), event_time (Timestamp)

Constraints
Every event references one listed user.
At least one event is present.
Country names compare by their stored case-sensitive text.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is join, aggregate, order, limit. Join events to users on user_id, group by country, and use COUNT(*) as event_count. Every event references one listed user, so an inner join loses nothing. Then ORDER BY event_count DESC, country ASC and LIMIT 1. That second sort key is the whole tie-break. The common pitfall is COUNT(DISTINCT user_id), which counts people, not events. Another is skipping the secondary sort and getting a random winner on ties. Country compares as case-sensitive text, so don't wrap it in LOWER(). Alias the columns exactly as specified. A RANK() window function works too, but it returns multiple rows on ties unless you break them, so LIMIT 1 is cleaner. If the syntax slips under pressure, StealthCoder is the hedge during the live OA.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Country with the Most Events cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Notion's OA.

Notion reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Country with the Most Events FAQ

What's the trick in the Country with the Most Events question?+

Count events, not users. Join events to users, group by country, use COUNT(*) as event_count, then sort by event_count descending and country ascending. The second sort key handles the alphabetical tie-break. Take the first row with LIMIT 1.

How hard is this Notion SQL question really?+

Easy to medium. There's one join and one aggregation. The difficulty is in the details: the tie-break rule, exact output column names, and not confusing event counts with distinct users. If you've written GROUP BY with ORDER BY before, you can finish it quickly.

Do I need a window function here?+

No. ORDER BY event_count DESC, country ASC LIMIT 1 is enough and simpler. RANK() or ROW_NUMBER() also work, but RANK() returns all tied countries unless you filter further. Use ROW_NUMBER() with the same ordering if you go that route.

Should I worry about NULLs or users with no events?+

Not much. Every event references one listed user, so an inner join is safe. At least one event exists, so the result is never empty. Users with no events don't matter since you only need the top country by event count.

How do I prepare for this in 48 hours?+

Write the query from scratch three times: join, group, order with a tie-break, limit. Then try variants like top country by distinct users or by event type. Check that your output columns are named exactly country and event_count, since a wrong alias can fail an otherwise correct answer.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Notion.

OA at Notion?
Invisible during screen share
Get it