MySQL Forums
Forum List  »  Newbie

Foreign Key
Posted by: Franck Jobard
Date: June 30, 2005 01:44AM

Hello,

I try to create tables with foreign keys so that not to delete rows when linked to another row of another tables

i try for example

DROP TABLE IF EXISTS LIVRE;
CREATE TABLE LIVRE (
id_livre int(11) NOT NULL auto_increment,
id_genre int(11) NULL , INDEX (id_genre),
CONSTRAINT `FK_LIVRE_GENRE` FOREIGN KEY (id_genre) REFERENCES genre(id_genre) ON DELETE RESTRICT
) TYPE=INNODB;

but i can delete a row from the table genre when exist a row in LIVRE that use it

Can someone give me the right syntax please ?

Franck

Options: ReplyQuote


Subject
Written By
Posted
Foreign Key
June 30, 2005 01:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.