Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Average Coach Response Time
00:00
5 left

Average Coach Response Time

MediumSQL · PostgreSQL

Problem

Given a table of message exchanges between Omada Health coaches and members, find the average response time for coaches, grouping by the day of the week.

Treat a coach message as a response only when the immediately preceding message in the same conversation was sent by a member. Ignore messages with a NULL sent_at value.

Output

  1. One row per weekday with at least one qualifying coach response.
  2. Columns: day_of_week and average_response_minutes, rounded to two decimal places.
  3. Order weekdays Monday through Sunday. Rows with a NULL sent_at value are ignored.

Schema

coach_member_messages
ColumnTypeDescription
message_idPKINTEGERUnique identifier for the message
conversation_idVARCHAR(100)Identifier for the coach-member conversation
sender_typeVARCHAR(100)Role of the message sender
sent_atTIMESTAMPTimestamp when the message was sent
Tablescoach_member_messages
Interviewer

Your question is Average Coach Response Time. Start with the requirements and the one table in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.