Re: erd to db

From: Jan Hidders <hidders_at_uia.ua.ac.be>
Date: Fri, 22 Mar 2002 10:11:00 +0100
Message-ID: <3c9af4b6$1_at_news.uia.ac.be>


"Yves Guerin" <yves.guerin_at_muhc.mcgill.ca> wrote in message news:bxpm8.7127$R8.88795_at_carnaval.risq.qc.ca...
>

> I have question about to map a erd to a ralational database:
>
> I have the following entities: E and W in binary ERD
> E: owner of W
> W: weak
> E: primary key is e1
> W: primary key is w1
> The relationship between E and W is R and R has a primary key: r1

I'm not sure what type of ERDs you are talking about, but in the usual ones your problem statement doesn't make sense. First, if W has a primary key then it is by definition not a weak entity, and second, there can be no such thing as the primary key of a relationship other than that which is implied by the involved entity types (if there would be then it is not a relationship but an entity type).

So it should have been:

An entity type E with primary key e.
A weak entity type W with a partial key w. A weak relationship R between E and W.

The usual way to implement this is to introduce a table for E with primary key e, and a table for W with primary key e + w. Note that you don't need a table for W.

  • Jan Hidders
Received on Fri Mar 22 2002 - 10:11:00 CET

Original text of this message