Hi I am creating four tables :
event (ecode, edesc, elocation, edate, etime, emax)
spectator (sno, sname, semail)
ticket (tno, ecode, sno)
cancel (tno, ecode, sno, cdate, cuser)
I have set ecode as PRIMARY KEY for event and tno for Ticket and sno for Spectator.
I added delete cascade in ticket for ecode and sno but it works fine with sno, that is when i delete a spectator the attribute is deleted from the child table too but the same is not happening with event:
CREATE TABLE ticket (
tno INT NOT NULL,
ecode CHAR(4) NOT NULL,
sno INTEGER NOT NULL,
CONSTRAINT ticket_pk PRIMARY KEY (tno),
FOREIGN KEY (ecode) REFERENCES event
ON DELETE CASCADE,
FOREIGN KEY (sno) REFERENCES spectator
ON DELETE CASCADE
);
What am i doing wrong?Please help