Re: A database design question.

From: Bob Hairgrove <>
Date: Sun, 12 May 2002 06:35:41 GMT
Message-ID: <>

On Sun, 12 May 2002 12:16:35 +0800, Calvin Tai <> wrote:

>Dear all,
> I have a database design question. I got two Entities A and B.
>There is a relation that if something belongs to Entity A, then it
>must also belongs to Entity B. But if something belongs to Entity B,
>it MAY NOT belongs to Entity B.

... shouldn't this be:
>it MAY NOT belongs to Entity A.

??? Otherwise, it doesn't make any sense. However, this is also not so easy to do as stated, because your two conditions are mutually exclusive (think about it). However...

> The reason why i have this question because if somethings have the
>nature Entity A, it should be have all the relations belongs to both
>Entity A & B. While if something have the nature of entity B only,
>then it only have the relations belongs to Entity B.
> Is there any idea how can i define this kind of relationship in a
>database design??
>Best regards,

What you are really saying is that A and B are sets, or domains, and A is a subset of B ... right?

If so, you could model this according to the base class / derived class ER model which is usually done by having two tables which are related 1-to-1 to each other; all the "A" attributes (base class) go into the A table, and the B attributes (derived class) go into table B, but only those that aren't already in table A. Join both tables to read the complete set of attributes for B.

Bob Hairgrove Received on Sun May 12 2002 - 08:35:41 CEST

Original text of this message