Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Time Overlap Analysis
00:00
5 left

SQL Time Overlap Analysis

MediumSQL · PostgreSQL

Problem

Analyze how many minutes where a single interview room had two or more interviewers at once using start_time and end_time.

Assume each row represents one interviewer scheduled in a room. Treat intervals as half-open, so an interviewer ending exactly when another begins does not create overlap. Include rooms with no overlapping time and ignore rows with missing or invalid timestamps.

Output

  1. One row per room with valid or recorded scheduling data.
  2. Columns: room_name, overlapping_minutes.
  3. Report total minutes during which at least two interviewers were present, ordered by room_name ascending.

Schema

interview_sessions
ColumnTypeDescription
session_idPKINTUnique identifier for the scheduled interviewer session
room_nameVARCHAR(100)Interview room identifier
interviewer_nameVARCHAR(150)Name of the interviewer assigned to the session
start_timeTIMESTAMPScheduled session start time
end_timeTIMESTAMPScheduled session end time
Tablesinterview_sessions
Interviewer

Your question is SQL Time Overlap Analysis. 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.