Overlapping User Sessions
A medium SQL mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- L4
Interview Prompt
The user_sessions table records session windows with a start and end time. Some users have sessions that overlap in time. Find all pairs of overlapping sessions for the same user. Two sessions overlap if one starts before the other ends and vice versa. Return the user_id, the session_ids of both overlapping sessions, and their respective start times. Do not return a session paired with itself.
Summary
Two sessions, one user, same clock. Something overlaps.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your sql solution with real code execution
- Get instant feedback and a hire/no-hire decision