Your question is Compute Avg Days to First Reaction. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Meta wants to measure how quickly people react after starting a conversation in Messenger. Write a SQL query to calculate the average number of days from each conversation's start time to the first reaction used in that conversation.
conversations table to get each conversation start time.message_reactions table to find the first reaction timestamp per conversation.| Column | Type | Description |
|---|---|---|
| conversation_idPK | BIGINT | Primary key for the conversation thread |
| thread_type | VARCHAR(20) | Surface type such as dm, group, or fb_groups |
| started_at | TIMESTAMP | Timestamp when the conversation started |
| Column | Type | Description |
|---|---|---|
| reaction_idPK | BIGINT | Primary key for the reaction event |
| conversation_id | BIGINT | Foreign key to conversations.conversation_id |
| reacted_at | TIMESTAMP | Timestamp when the reaction was used |
| reaction_type | VARCHAR(20) | Reaction type such as like, love, haha, wow, care, or sad |