Re: Cascading update on primary key
From: Joe Celko (joe.celko_at_northface.edu)
Date: 03/24/04
- Next message: Delbert Glass: "Re: PWDCOMPARE"
- Previous message: Xavier Lazard: "Re: How to search all stored procedures for a table name or column name"
- In reply to: pmcguire: "Cascading update on primary key"
- Next in thread: pmcguire: "Re: Cascading update on primary key"
- Reply: pmcguire: "Re: Cascading update on primary key"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 13:22:49 -0800
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Here is my guess from your narrative:
>> There are 2 (secondary) tables [the kids] whose primary keys depend
on the first table's primary key, and a third table [Barbies] whose
primary key depends on one of the 2 secondary tables [Daughter]. <<
CREATE TABLE Mothers
(mom CHAR(5) NOT NULL PRIMARY KEY);
CREATE TABLE Sons
(mom CHAR(5) NOT NULL
REFERENCES Mothers(mom)
ON DELETE CASCADE
ON UPDATE CASCADE,
son CHAR(5) NOT NULL);
CREATE TABLE Daughters
(mom CHAR(5) NOT NULL
REFERENCES Mothers(mom)
ON DELETE CASCADE
ON UPDATE CASCADE,
sis CHAR(5) NOT NULL UNIQUE);
CREATE TABLE Barbies
(sis REFERENCES Daughters(sis)
ON DELETE CASCADE
ON UPDATE CASCADE,
doll CHAR(5) NOT NULL);
How close was my guess?
--CELKO--
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: Delbert Glass: "Re: PWDCOMPARE"
- Previous message: Xavier Lazard: "Re: How to search all stored procedures for a table name or column name"
- In reply to: pmcguire: "Cascading update on primary key"
- Next in thread: pmcguire: "Re: Cascading update on primary key"
- Reply: pmcguire: "Re: Cascading update on primary key"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|