Back to questions

Teams Power Users Microsoft SQL Interview Question

Teams Power Users

Microsoft SQL Interview Question

Write a query to identify the top 2 Power Users who sent the highest number of 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 order based on the count of the messages.

Assumption:

  • No two users have 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

The dataset you are querying against may have different input & output - this is just an example!

Input

Output