Check Constraint in MySQL
Hi! everyone i have check constraint example like this:
create table persons
P_Id int not null,
LastName varchar(255) not null,
The above example run successfully but it allow me to input P_Id to 0 which is against the condition. Why it is happening? I take this example from w3school.
From the MySQL Documentation:
"The CHECK clause is parsed but ignored by all storage engines."
It is still worth specifying because (1) it expresses to future developers your intent; (2) future engines may enforce the constraint.