Re: Relation problem
Date: 26 Jan 2001 23:25:21 GMT
Message-ID: <94t111$f77$1_at_news.tue.nl>
wrote:
> On 26 Jan 2001 13:03:09 GMT, hidders_at_REMOVE.THIS.win.tue.nl (Jan
> Hidders) wrote:
>
> >Sure, but then you are dropping the constraint the the Organization
> >table is the union of the two "subtables". That's fine as long as you
> >are clear about what every tuple in every table means.
>
> The Organization table isn't the union of anything.
No, not exactly, of course. But the projection of the Parties table on the PartyID column is the union of the projection of Organizations table on the OrgID column and the projection of the Persons table on the PersonID column. (But only after renaming the columns appropriately of course.) My apologies for being a bit sloppy before, but I thought that would be clear from the context since I already had made the same point before.
> Do you *know* what a supertype is? Judging by your contribution to
> this thread, I'd have to say you don't. It looks like you're just
> throwing words around.
*sigh* Yes, I know what a supertype is, I have been teaching the concept in ER, NIAM and UML and it plays a part in my PhD research.
> Maybe these bite-sized pieces of SQL will help.
By now I hope that you understand that I am missing the following constraint in your SQL:
ALTER TABLE Parties
ADD CONSTRAINT AbstractClass
CHECK (
EXISTS (
SELECT * FROM Persons WHERE Persons.PersonID = Parties.PartyID
)
OR
EXISTS (
SELECT * FROM Organizations WHERE Organizations.OrgID = Parties.PartyID
)
)