From: Martijn Tonies Date: November 28 2003 5:45pm Subject: Re: CHECK constraint List-Archive: http://lists.mysql.com/mysql/154671 Message-Id: <00f001c3b5d7$78661d20$0e02a8c0@martijn> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi, > I created a table as follows: > > mysql> CREATE TABLE test ( > -> age INT(3), > -> CONSTRAINT CHECK (age > 0) > -> ); > Query OK, 0 rows affected (0.00 sec) > > I then inserted -1 into the table, which it shouldn't > have let me do. > > mysql> insert into test values (-1); > Query OK, 1 row affected (0.00 sec) > > mysql> select *From test; > +------+ > | age | > +------+ > | -1 | > +------+ > 1 row in set (0.01 sec) > > How can I enforce the CHECK constraint ? MySQL doesn't support CHECK constraints: http://www.mysql.com/doc/en/CREATE_TABLE.html With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL Server. Upscene Productions http://www.upscene.com