Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a table which will allow to insert values into a column with values greater than 10. When I tried in net, they suggested to create table in following way.

CREATE TABLE test ( UID int(11) NOT NULL auto_increment, ID int(11) default NULL, CHECK (ID > 10), PRIMARY KEY (UID) );

And when I try to insert an entry with values less than 10, still values are getting inserted.

I can use Before trigger on the table to restrict insertion of values less than 10. But I wanted other approach which satisfies this condition.

I am using MySQL server 5.0.24

Please help me out of this.

share|improve this question

According to MySQL doc: "The CHECK clause is parsed but ignored by all storage engines."

share|improve this answer
Thanks for the answer. Is there any other approach to have check on the column other than trigger. – Phanindra Jun 16 '11 at 9:46
Not at a the moment. It's the only solution so far. – olefebvre Jun 17 '11 at 13:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.