As of MySQL 8.0.16, we can create CHECK
constraints in MySQL.
A CHECK
constraint is a type of integrity constraint. It specifies a search condition to check the value being entered into a row. If the value being entered violates the CHECK
constraint, then the result of the search condition is FALSE
and an error occurs (unless the IGNORE
clause is used in the SQL statement, in which case a warning is reported and the offending row is skipped).
The ability to create CHECK
constraints was introduced in MySQL 8.0.16. Prior to version 8.0.16, MySQL actually allowed a limited version of CHECK
constraint syntax, but it was completely ignored (no CHECK
constraint was created or evaluated).
Continue reading →