Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Overlapping Appointments

Return every pair of appointments (smaller id first) of the same doctor whose time ranges overlap. Appointments that only touch at an end point do not overlap. Order by the pair.

Table schema

Appointments(id INT PRIMARY KEY, doctor VARCHAR(5), start_time TIME, end_time TIME)

Sample data

id | doctor | start_time | end_time
1 | D1 | 09:00 | 10:00
2 | D1 | 09:30 | 10:30
3 | D1 | 11:00 | 12:00
4 | D2 | 09:00 | 10:00

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.