db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MZ_TRICSTA <mz_tric...@yahoo.com>
Subject Determine which child table a record belongs to
Date Tue, 29 Jan 2008 17:46:09 GMT

Hello All,

I have the following tables in my database -:

CREATE TABLE Crane
(
PTTEquipmentID INTEGER NOT NULL,
LiftingCapacity INTEGER NOT NULL,
PRIMARY KEY (PTTEquipmentID),
FOREIGN KEY (PTTEquipmentID) REFERENCES Equipment ON DELETE CASCADE
)

CREATE TABLE RoughTerrainCrane
(
PTTEquipmentID INTEGER NOT NULL,
PRIMARY KEY (PTTEquipmentID),
FOREIGN KEY (PTTEquipmentID) REFERENCES Crane ON DELETE CASCADE
)

CREATE TABLE AllTerrainCrane
(
PTTEquipmentID INTEGER NOT NULL,
PRIMARY KEY (PTTEquipmentID),
FOREIGN KEY (PTTEquipmentID) REFERENCES Crane ON DELETE CASCADE
)

CREATE TABLE TruckCrane
(
PTTEquipmentID INTEGER NOT NULL,
PRIMARY KEY (PTTEquipmentID),
FOREIGN KEY (PTTEquipmentID) REFERENCES Crane ON DELETE CASCADE
)

CREATE TABLE CarryDeckCrane
(
PTTEquipmentID INTEGER NOT NULL,
PRIMARY KEY (PTTEquipmentID),
FOREIGN KEY (PTTEquipmentID) REFERENCES Crane ON DELETE CASCADE
)

CREATE TABLE CrawlerCrane
(
PTTEquipmentID INTEGER NOT NULL,
PRIMARY KEY (PTTEquipmentID),
FOREIGN KEY (PTTEquipmentID) REFERENCES Crane ON DELETE CASCADE
)

CREATE TABLE RingCrane
(
PTTEquipmentID INTEGER NOT NULL,
PRIMARY KEY (PTTEquipmentID),
FOREIGN KEY (PTTEquipmentID) REFERENCES Crane ON DELETE CASCADE
)

'Crane' is the parent table of 'RoughTerrainCrane', 'AllTerrainCrane',
'TruckCrane', 'CarryDeckCrane', 'CrawlerCrane' and 'RingCrane'. If I have a
'Crane' key, how do I determine which of the child tables the key belongs to
without querying each child table?

I greatly appreciate any effort to help me. Thank you for your time and
consideration.

Sincerely,
Tricsta
-- 
View this message in context: http://www.nabble.com/Determine-which-child-table-a-record-belongs-to-tp15164998p15164998.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message