I try to create a table where 'dateFrom' and 'dateTo' fields need to be higher than today's date. So I used CHECK like this
CREATE TABLE Booking (
hotelNo int(10),
guestNo int(10),
dateFrom datetime,
dateTo datetime,
roomNo int(10),
CHECK (dateFrom >= CURDATE() AND dateTo >= CURDATE())
);
But I keep getting this error
ERROR 1901 (HY000): Function or expression 'curdate()' cannot be used in the CHECK clause of `CONSTRAINT_1`
I've searched this on Google many times, but still couldn't figure out a way to do it.