When we create or alter a CHECK
constraint in MySQL, we have the option of setting it to ENFORCED
or NOT ENFORCED
. This determines whether or not MySQL will enforce the rules of the constraint whenever data that violates the constraint tries to enter the database.
We can use the ALTER TABLE
statement to change the enforcement state of an existing CHECK
constraint in MySQL, as shown in the following example.