At Meta, a Product Growth Analyst may need to monitor recent messaging activity in Messenger as part of broader AARRR engagement analysis for Facebook Groups and sharing surfaces. Write a SQL query to find the top 3 users who sent the most messages in the last 7 days.
sender_user_id sent in the last 7 days relative to DATE '2024-06-13'.users table to return the sender's username.user_id, username, and messages_sent.messages_sent descending, then user_id ascending to break ties, and return only the top 3 rows.Note: Treat DATE '2024-06-13' as today's date.
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Meta user ID |
| username | VARCHAR(50) | Messenger username |
| account_status | VARCHAR(20) | Current account status |
| signup_date | DATE | Account creation date |
| Column | Type | Description |
|---|---|---|
| message_idPK | INT | Unique message ID |
| sender_user_id | INT | User who sent the message |
| recipient_user_id | INT | User who received the message |
| sent_at | TIMESTAMP | Timestamp when the message was sent |
| surface | VARCHAR(30) | Meta product surface where the message originated |