Skip to content
Advertisement

How to validate filleds in mysql for date today and onwards?

I am trying to use the following code

However it gives the following error saying that curdate function is disallowed in check. – Error

Advertisement

Answer

Only deterministic functions may be used in CHECK constraint expression. You cannot create such CHECK.

Use BEFORE INSERT trigger:

https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=9bc964fbaab469ec841e62be99db4efd

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement