Hi all, I am pretty new to mySQL actually I started yesterday. mySQL with innoDB handles integrity constraints. I tried :
create table a ( id varchar(3) not null, primary key(id) ) TYPE=INNODB; insert into a values ('aaa'); create table b ( id varchar(3) not null, a_id varchar(3), index idx_b_a_id (a_id), foreign key (a_id) references a (id), primary key(id) ) TYPE=INNODB; insert into b values ('AAA','aaa'); insert into b values ('BBB',null); the last statment doesn't work ... ERROR 1216: Cannot add a child row: a foreign key constraint fails I am using mySQL version 3.23.49 (and 4.0.1-alpha) on win2Ksp2 "mysqld-max --standalone --console" Thanks, Alain --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php