deleting a row potentially referenced by many rows in another table
From: cm <cmonthenet_at_yahoo.com>
Date: Tue, 29 Sep 2009 10:36:47 -0700 (PDT)
Message-ID: <00338477-5f62-4388-8599-665086abda5c_at_r36g2000vbn.googlegroups.com>
I have a situation that is somewhat the opposite of the case in which you would use ON DELETE CASCADE on a foreign key in a child table to ensure that when a row in the parent table was deleted, the delete would cascade to the matching rows in the Child table (see example below).
Date: Tue, 29 Sep 2009 10:36:47 -0700 (PDT)
Message-ID: <00338477-5f62-4388-8599-665086abda5c_at_r36g2000vbn.googlegroups.com>
I have a situation that is somewhat the opposite of the case in which you would use ON DELETE CASCADE on a foreign key in a child table to ensure that when a row in the parent table was deleted, the delete would cascade to the matching rows in the Child table (see example below).
CREATE TABLE Parent (
parentId INT NOT NULL,
PRIMARY KEY(parentId)
);
CREATE TABLE Child (
childId INT NOT NULL,
PRIMARY KEY(childId),
FOREIGN KEY (parentId) REFERENCES Parent(parentId)
);
Thanks,
CM
Received on Tue Sep 29 2009 - 19:36:47 CEST