Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top Chatters Message Frequency

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Top Chatters Message Frequency. Start with the requirements and the three tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Twitch wants to identify the most active chatters in each channel during the first week of August 2026. Write a PostgreSQL query using Twitch channel and chat event data to rank registered chatters by message frequency.

Requirements

  1. Include only message events from August 1 through August 7, 2026, inclusive.
  2. Return the top two registered chatters per Twitch channel, ranked by message count descending.
  3. Include each chatter's message count and percentage of all qualifying messages in that channel.
  4. Break ties deterministically by username and user ID, and order the final results by channel name and rank.

Schema

channels
ColumnTypeDescription
channel_idPKINTTwitch channel identifier
channel_nameVARCHAR(100)Channel display name
users
ColumnTypeDescription
user_idPKINTRegistered Twitch user identifier
usernameVARCHAR(50)Twitch username
chat_events
ColumnTypeDescription
event_idPKINTChat event identifier
channel_idINTReferenced Twitch channel
user_idINTUser who generated the event
event_typeVARCHAR(30)Event category
event_timeTIMESTAMPTime at which the event occurred
Tableschannelsuserschat_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results