Write SQL and Python, run instantly in your browser, and track your progress.
You are a Trust & Safety Analyst at Meta. The team needs the latest direct message between each pair to prioritize case reviews. Your task is to provide, for each sender–recipient pair, the most recent message with its send time and delivery status. Exclude messages that were removed. Sort by the smallest sender identifier, then by the smallest recipient identifier; break ties by the smallest message identifier.
| Column Name | Type |
|---|---|
| message_id | INTEGER |
| sender_user_id | INTEGER |
| recipient_user_id | INTEGER |
You are a Trust & Safety Analyst at Meta. The team needs the latest direct message between each pair to prioritize case reviews. Your task is to provide, for each sender–recipient pair, the most recent message with its send time and delivery status. Exclude messages that were removed. Sort by the smallest sender identifier, then by the smallest recipient identifier; break ties by the smallest message identifier.
| Column Name | Type |
|---|---|
| message_id | INTEGER |
| sender_user_id | INTEGER |
| recipient_user_id | INTEGER |
| sent_at |
| sent_at |
| TEXT |
| TEXT |
| content_text | TEXT |
| content_text | TEXT |
| status | TEXT |
| status | TEXT |
| message_id | sender_user_id | recipient_user_id | sent_at | content_text | status |
|---|---|---|---|---|---|
| 1 | 1 | 33 | 2025-04-18 02:49:41 | Hi! I'm working on something similar. Would love to chat! | delivered |
| 2 | 1 | 4 |
| message_id | sender_user_id | recipient_user_id | sent_at | content_text | status |
|---|---|---|---|---|---|
| 1 | 1 | 33 | 2025-04-18 02:49:41 | Hi! I'm working on something similar. Would love to chat! | delivered |
| 2 | 1 | 4 |
| sender_user_id | recipient_user_id | message_id | sent_at | status | message_rank |
|---|---|---|---|---|---|
| 1 | 4 | 2 | 2025-04-10 02:40:32 | delivered | 1 |
| 1 | 33 | 1 | 2025-04-18 02:49:41 | delivered | 1 |
| 2 | 5 |
| sender_user_id | recipient_user_id | message_id | sent_at | status | message_rank |
|---|---|---|---|---|---|
| 1 | 4 | 2 | 2025-04-10 02:40:32 | delivered | 1 |
| 1 | 33 | 1 | 2025-04-18 02:49:41 | delivered | 1 |
| 2 | 5 |
Showing first 5 of 281 rows. Latest message per conversation pair.
Showing first 5 of 281 rows. Latest message per conversation pair.
| 2025-04-10 02:40:32 |
| 2025-04-10 02:40:32 |
| Thanks for sharing that resource! Super helpful. |
| Thanks for sharing that resource! Super helpful. |
| delivered |
| delivered |
| 3 | 2 | 58 | 2025-07-04 22:32:15 | Quick question - what tools do you use for productivity? | read |
| 3 | 2 | 58 | 2025-07-04 22:32:15 | Quick question - what tools do you use for productivity? | read |
| 4 | 2 | 5 | 2025-04-24 01:06:27 | Hi there! Fellow Developer here. Love your work! | read |
| 4 | 2 | 5 | 2025-04-24 01:06:27 | Hi there! Fellow Developer here. Love your work! | read |
| 5 | 2 | 50 | 2025-08-22 06:30:27 | Hey! Saw your post about productivity. Really resonated with me. | delivered |
| 5 | 2 | 50 | 2025-08-22 06:30:27 | Hey! Saw your post about productivity. Really resonated with me. | delivered |
| 4 |
| 4 |
| 2025-04-24 01:06:27 |
| 2025-04-24 01:06:27 |
| read |
| read |
| 1 |
| 1 |
| 2 | 12 | 9 | 2025-05-22 04:40:09 | read | 1 |
| 2 | 12 | 9 | 2025-05-22 04:40:09 | read | 1 |
| 2 | 33 | 8 | 2025-07-17 00:44:06 | delivered | 1 |
| 2 | 33 | 8 | 2025-07-17 00:44:06 | delivered | 1 |