Re: How to normalize these 3 tables?

From: Bill Thorsteinson <billthor_at_yahoo.com>
Date: Thu, 09 Mar 2000 01:12:32 GMT
Message-ID: <38c7f965.995701_at_news.videotron.ca>


On Wed, 08 Mar 2000 23:55:11 GMT, 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
Drop the drug id here. The only possible use here is to indicate a primary project for the drug.
>drug_project_id integer foreign key drug_project(drug_project_id)
>
>table DRUG_PROJECT:
Drop the drug project id here. This is a relationship table, and should have the primary keys of it parent tables (Project and Drug) as its compound primary key.
>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.
>
>Susana
>
/Bill Thorsteinson Received on Thu Mar 09 2000 - 02:12:32 CET

Original text of this message