1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
-- with DATE
select
start_date,
end_date
from test_overlaps
where (start_date, end_date) overlaps (DATE '2023-02-15', DATE '2023-03-15');
select
start_date,
end_date
from test_overlaps
where (start_date, end_date) overlaps ('2023-02-15', '2023-03-15');
SELECT
t1.start_date,
t1.end_date
FROM test_overlaps1 AS t1
LEFT JOIN test_overlaps2 AS t2
WHERE (t1.start_date, t1.end_date) OVERLAPS (t2.start_date, t2.end_date);
SELECT
start_date,
end_date
FROM test_overlaps
WHERE (start_date, end_date) OVERLAPS ('2023-12-30T00:00:00'::TIMESTAMP, '2024-01-14T13:01:39.884877'::TIMESTAMP);
SELECT
start_date,
end_date
FROM test_overlaps
WHERE ('2023-12-30T00:00:00'::TIMESTAMP, '2024-01-14T13:01:39.884877'::TIMESTAMP) OVERLAPS (start_date, end_date);
SELECT
start_date,
end_date
FROM test_overlaps
WHERE (start_date, end_date) OVERLAPS (DATE '2023-12-30', INTERVAL '2 HOURS');
SELECT
start_date,
end_date
FROM test_overlaps
WHERE (DATE '2023-12-30', DATE '2024-01-14') OVERLAPS (start_date, end_date);
SELECT
start_date_1,
start_date_2,
end_date
FROM test_overlaps
WHERE (DATE '2023-12-30', DATE '2024-01-14') OVERLAPS (GREATEST(start_date_1, start_date_2), end_date);
|