Re: How to normalize these 3 tables?

From: Douglas Cowles <dcowles_at_us.ibm.com>
Date: Thu, 09 Mar 2000 11:42:53 -0500
Message-ID: <38C7D48D.B0B031B1_at_us.ibm.com>


Then you don't need the foreign key to drug_project in drug. DRUG_PROJECT becomes a many-to-many association table allowing multple drugs per project as well as multiple projects per drug. If you took that out.. I think you would be fine.
One other thing I would consider is taking off the id from drugproject and making the combination of drug and project the foreign key as well as the primary key but you may have other reasons for your id field.. After all that.. look normalized to me.

  • Dc.

susana73_at_hotmail.com wrote:

> Hi, I was given 3 tables and am wondering how to normalize or
> restructure them:
>
> table PROJECT:
> project_id integer primary key
> project_name varchar2(20)
>
> table DRUG:
> drug_id integer primary key
> drug_project_id integer foreign key drug_project(drug_project_id)
>
> table DRUG_PROJECT:
> drug_project_id integer primary key
> project_id integer foreign key project(project_id)
> drug_id integer foreign key drug(drug_id)
>
> The reason I have drug_project is because the same drug can associate
> with different projects and I would like to have an unique id for each.
> But it looks like it won't work since I have to foreign keys pointing
> each other on 2nd and 3rd tables.
>
> I appreciate your help. Thanks!
>
> Susana
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Mar 09 2000 - 17:42:53 CET

Original text of this message