check constraint does not work? I have the following table. 

create table test (
   id smallint unsigned AUTO_INCREMENT,
   age tinyint not null,
   primary key(id),
   check (age&lt;20)
);


The problem is that the CHECK constraint does not work on the age column. For example, when I insert 222 for the age field MySQL accepts it.
CHECK constraints are not implemented in MySQL. From CREATE TABLE


  The CHECK clause is parsed but ignored by all storage engines. See Section 12.1.17, “CREATE TABLE Syntax”. The reason for accepting but ignoring syntax clauses is for compatibility, to make it easier to port code from other SQL servers, and to run applications that create tables with references. See Section 1.8.5, “MySQL Differences from Standard SQL”. 


It's also been a reported bug for almost 8 years...