SQL - Advanced Query Patterns
Given a table bookings(start_date, end_date) with rows:
1) 2024-06-01 to 2024-06-05
2) 2024-06-04 to 2024-06-10
What will this query return?
1) 2024-06-01 to 2024-06-05
2) 2024-06-04 to 2024-06-10
What will this query return?
SELECT * FROM bookings b1 JOIN bookings b2 ON b1.start_date <= b2.end_date AND b1.end_date >= b2.start_date WHERE b1.start_date <> b2.start_date;