I got this two tables:
CREATE TABLE `reservation` (
`id_reservation` int(11) PRIMARY KEY,
`reserved_date` date NOT NULL,
`id_event` int(11) NOT NULL,
FOREIGN KEY (`id_event`) REFERENCES `event`
)
CREATE TABLE `event` (
`id_event` int(11) PRIMARY KEY,
`begin_date` date NOT NULL,
`end_date` date NOT NULL,
)
Basically I insert a reservation that has a single reserved_date. The reservation is related to the event, that has a begin_date and an end_date.
I need to check that reserved_date is included (y <= x <= z) in the begin_date and end_date of that particular event.