Practice Interview Questions
| Question | Status |
|---|---|
Your task is to write a query to determine the number of unique conversation threads in the messenger_sends table.
A unique conversation thread is defined as a unique pair of sender_id and receiver_id, where the direction of the message (who sent to whom) does not matter. In other words, the pair (1, 2) should be considered the same as (2, 1).
messenger_sends table:
| Column Name | Description |
|---|---|
| sender_id | ID of the user sending the message |
| receiver_id | ID of the user receiving the message |
| unique_threads |
|---|
| 5 |
Your task is to write a query to determine the number of unique conversation threads in the messenger_sends table.
A unique conversation thread is defined as a unique pair of sender_id and receiver_id, where the direction of the message (who sent to whom) does not matter. In other words, the pair (1, 2) should be considered the same as (2, 1).
messenger_sends table:
| Column Name | Description |
|---|---|
| sender_id | ID of the user sending the message |
| receiver_id | ID of the user receiving the message |
| unique_threads |
|---|
| 5 |