logo

Back to questions

Teams Power Users

Easy

Write a query to find the top 2 power users who sent the most messages on Microsoft Teams in August 2022. Display the IDs of these 2 users along with the total number of messages they sent. Output the results in descending count of the messages.

Assumption:

  • No two users has sent the same number of messages in August 2022.

Table:

Column NameType
message_idinteger
sender_idinteger
receiver_idinteger
contentvarchar
sent_datedatetime

Example Input:

message_idsender_idreceiver_idcontentsent_date
90136014500You up?08/03/2022 00:00:00
90245003601Only if you're buying08/03/2022 00:00:00
74336018752Let's take this offline06/14/2022 00:00:00
92236014500Get on the call08/10/2022 00:00:00

Example Output:

sender_idmessage_count
36012
45001

PostgreSQL 14

Refer friends to get bonus content & cool prizes.