A slot does not overlap with another if it ends before the other starts, or it starts after the other ends.

where '11:55' < StartTime or EndTime < '10:00'

To find overlapping slots, invert the rule. It ends after the other starts and it starts before the other ends.

where StartTime < '11:55' and '10:00' < EndTime

There’s no need to cast the values, MySQL will do it for you, assuming StartTime and EndTime are time columns.

Try it.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top