Hi All I am currently using 3.23.49 Max on Win 2K. I just saw from the docs that this version supports foreign key...So i just thought of working on it...
I just created two tables parent and child CREATE TABLE parent(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE SET NULL) TYPE=INNODB; Then i inserted values into Parent Insert into parent (id) values(1); Insert into parent (id) values(2); Insert into parent (id) values(3); Then i inserted values into the child Insert into child values(1,1) Insert into child values(1,2) Insert into child values(1,3) Insert into child values(2,1) Insert into child values(2,2) Insert into child values(2,8) mysql> select * from child; +------+-----------+ | id | parent_id | +------+-----------+ | 1 | 1 | | 1 | 2 | | 1 | 3 | | 2 | 1 | | 2 | 2 | | 2 | 8 | |+------+-----------+ 9 rows in set (0.01 sec) If the foreign key is set i should have not been able to insert 8 in the child table as a parent_id. Also i deleted 2 from the parent tabl which didnt afftect the child table... So can anyone let me know the steps involved in creating an Inno Db and to achieve the Foreign key relationship Regards, -Arul --------------------------------------------------------------------- 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