"Scott Purcell" <[EMAIL PROTECTED]> wrote: > > I am trying to create some tables that I can use the delete on cascade = > function for. This would help me code the project and ensure data = > integrity. I am on the docs @ = > http://www.mysql.com/doc/en/InnoDB_foreign_key_constraints.html but I am = > not quite understanding the syntax. > > I am creating two test tables to work out the logic. What I want to do = > is delete a certain 'ID' from 'table 'ONE' and have it delete the same = > foreign key id of the same value in table 'TWO'. > > Here is what I have entered into the mysql command. > mysql> create table one (id varchar(2) not null, name varchar(20), = > primary key ( > id)) type=3DINNODB; > That is table one, with a primary key on ID; > Now the foreign key table; > > mysql> create table two (fid varchar(2), fname varchar(20), fOREIGN KEY = > (fid) RE > FERENCES one(id) on delete cascade); > > Insert data: > one: > id name > 1 'scott' > 2 'benjamin' > > two: > fid name > 1 'twoscott' > 2 'twobenjamin' > > > > Problem is when I delete from one where id =3D '1' it does not delete = > the foreign key one in table two. >
Check type of the tables with SHOW CREATE TABLE or SHOW TABLE STATUS statements. I guess they have MyISAM table type. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]