By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE `test_table` (
`ID` int(11) NOT NULL,
`start_date` datetime NOT NULL,
`end_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `test_table` (`ID`, `start_date`, `end_date`) VALUES
(1, '2021-05-03 01:30:01', '2021-05-03 02:00:01'),
(2, '2021-05-03 02:00:02', '2021-05-03 02:30:02'),
(3, '2021-05-03 02:30:03', '2021-05-03 03:00:03'),
(4, '2021-05-03 03:00:03', '2021-05-03 04:00:03');
Records: 4 Duplicates: 0 Warnings: 0
select * from test_table
where start_date < '2021-05-03 4:00:00' and
end_date > '2021-05-03 2:30:03'
ID | start_date | end_date |
---|---|---|
3 | 2021-05-03 02:30:03 | 2021-05-03 03:00:03 |
4 | 2021-05-03 03:00:03 | 2021-05-03 04:00:03 |