| 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 |
|
|
  | |  | question: check constraint | question: check constraint 2004-03-13 - By Paul DuBois
Back 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)
|
|
 |