Re: Using the same FK in a table more then once
From: -CELKO- <jcelko212_at_earthlink.net>
Date: 23 Sep 2006 08:21:35 -0700
Message-ID: <1159024894.910279.67010_at_k70g2000cwa.googlegroups.com>
Date: 23 Sep 2006 08:21:35 -0700
Message-ID: <1159024894.910279.67010_at_k70g2000cwa.googlegroups.com>
>> Academically speaking.. is it acceptable to have this scenario? <<
Yes, but you will find that SQL Server and some oither products chock on it: Something like this?
CREATE TABLE Ownership
(item_id INTEGER NOT NULL
REFERENCES Inventory (item_id),
current_owner INTEGER NOT NULL
REFERENCES Owners (owner_id),
prior_owner INTEGER NOT NULL
REFERENCES Owners (owner_id),
PRIMARY KEY (item_id, current_owner),
CHECK (current_owner <> prior_owner));
Received on Sat Sep 23 2006 - 17:21:35 CEST