Slack Power Users
Slack 👶 Easy SQL
Beginner Mode

Objective

Write a SQL query to identify the top two users who sent the most messages in August 2022 on Slack.

Table Schema:

  • messages
Column Type Description
message_id INTEGER Unique identifier for each message
user_id INTEGER ID of the user who sent the message
sent_date DATETIME Date and time when the message was sent

Task Requirements:

  • Filter only messages sent in August 2022
  • Count the total messages sent by each user
  • Identify the top two users with the highest message counts
  • Return user IDs with their message counts sorted in descending order

Output columns: user_id, message_count

Examples

Example 1:

Input:

messages
message_idsent_dateuser_id
12022-08-01 10:00:00101
22022-08-02 11:00:00101
32022-08-03 12:00:00101
42022-08-05 13:00:00102
52022-08-06 14:00:00102
62022-08-07 15:00:00103

Output:
message_countuser_id
3101
2102
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →