Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.