Mailing List
Home
MySQL General - General MySQL discussion
MaxDB - Everything about MaxDB, formerly known as SAP DB
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
ODBC - ODBC with the MySQL Connector/ODBC driver
Perl - Perl support for MySQL with DBI and DBD::mysql
MySQL++ - Programming with the C++ API to MySQL
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
question: check constraint

question: check constraint

2004-03-13       - By Paul DuBois

 Back
Reply:     1     2  

At 20:10 -0800 3/13/04, Andrew Zhu wrote:
>Mysql 4.0.12 on win xp.
>
>Question: is the check constraint supported?
>
>Example:
>create table temp (
>c1 varchar (50) check (c1 like "%@% ")
>);
>
>insert into temp values ( "whatever ");
>
>will succeed. Is my constraint wrong (say to check the
>email address)? or this is just parsed without
>enforcement?

The latter:

http://www.mysql.com/doc/en/CREATE_TABLE.html

In MySQL Version 3.23.44 or later, InnoDB tables support checking of
foreign key constraints. See section 15 The InnoDB Storage Engine. Note
that the FOREIGN KEY syntax in InnoDB is more restrictive than the syntax
presented above: The columns of the referenced table must always be
explicitly named. InnoDB supports both ON DELETE and ON UPDATE actions
on foreign keys as of MySQL 3.23.50 and 4.0.8, respectively. See the
InnoDB manual section for the precise syntax. See section 15.6.4 FOREIGN
KEY Constraints. For other storage engines, MySQL Server does parse the
FOREIGN KEY and REFERENCES syntax in CREATE TABLE commands, but without
further action being taken. The CHECK clause is parsed and ignored for
all storage engines. See section 1.8.5.5 Foreign Keys.

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

MySQL Users Conference: April 14-16, 2004
http://www.mysql.com/uc2004/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql @(protected)