The MySQL Reference Manual says:
The CHECK clause is parsed but ignored by all storage engines.
No mistake. I've read that over 10 times.
So what's the whole point of writing check constr开发者_运维知识库aints then?
It's there because of interoperability concerns. You can for example import an SQL script that is generated by other RDBMSs that support CHECK constraint (say Oracle).
There is no point. I think they prepared the database to accept check constraints by adding support for them in the SQL parser but none of the engines still support them.
It's been a bug report for over 7 years.
http://bugs.mysql.com/bug.php?id=3464
Personal opinion: another reason not to use MySQL, like NATURAL JOIN (and again) and random aggregates
精彩评论