Foreign key question
I was experimenting with the following code:
CREATE TABLE reviewing
(
reviewingid INTEGER ,
papername text,
reviewername text,
PRIMARY KEY(reviewingid)
);
CREATE TABLE score
(
reviewingid integer,
questionnumber integer,
score integer,
FOREIGN KEY (reviewingid) REFERENCES reviewing (reviewingid) on delete cascade
);
insert into reviewing values (1,"how to survive","John Doe") ;
insert into score values(1,1,5);
delete from reviewing where reviewingid = 1;
My questions is this, I can't get the cascade delete to work. I'm on MySql 5 on my host. Am I thinking that it won't delete the entry from both tables??
Edited 1 time(s). Last edit at 11/07/2008 05:05PM by Steve Grosz.
Subject
Views
Written By
Posted
Foreign key question
3006
November 07, 2008 05:05PM
1794
November 07, 2008 11:21PM
1734
November 08, 2008 06:24AM
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.