Hello everyone, in this little post we will review a new feature in MySQL 8.
What is “CHECK Constraint”?
This is a new feature to specify a condition to check the value before INSERT or UPDATE into a row. The constraint could return an error if the result of a search condition is FALSE for any row of the table (but not if the result is UNKNOWN or TRUE).
This feature starts working on MySQL 8.0.16, and in previous versions, we could create it, but it doesn’t work, meaning the syntax is supported but it is not working,
There are some rules to keep in mind…
– AUTO_INCREMENT columns are not permitted
– Refer to another column in another table is not permitted
– Stored functions and user-defined functions are not permitted
(you can not call a function or any user-defined functions)
– Stored procedure and function parameters are not permitted (you
cannot call …