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


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to