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.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.