How do you determine overlapping date ranges?
You can do this by swapping the ranges if necessary up front. Then, you can detect overlap if the second range start is: less than or equal to the first range end (if ranges are inclusive, containing both the start and end times); or. less than (if ranges are inclusive of start and exclusive of end).
How do you handle overlapping dates in SQL?
SQL Query using Lag Function for OverLapping Time Intervals
SQL programmers now can use SQL LAG() function to compare all table rows with the previous row when ordered by ID column. Maybe it would be better to select the compared previous row using LAG() function sorting rows by StarDate.