Re: three table join

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Kumar S <ps_postgres(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org, olly(at)lfix(dot)co(dot)uk
Subject: Re: three table join
Date: 2004-11-02 18:34:46
Message-ID: DF10E4BC-2CFD-11D9-807B-000A95D7BA10@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Nov 2, 2004, at 12:56 PM, Kumar S wrote:

> Hello Oliver,
> Thank you for your mail with suggestions. I decided
> to keep the con_exp_id as primary key because of the
> fact that a contact can do as many experiments as he
> can and one experiment can be done many contacts.
> Thus these two tables share a Many to Many
> relationship.
>
>
> Thus for other tables con_exp_id will be made as
> Foreign key .
>
> For example:
>
> Table: Chip_table
> chip_id (PK)
> con_exp_id (FK)
> ......
> .....
>
> Here it is easy for me to anchor con_exp_id as FK from
> con_exp_link table.
>
> Any other better alternative?
>
> Thanks
>
> Kumar
>

Kuman,

This implies that you will have a row in the chip table for every
con_exp row, so you wouldn't need the con_exp table at all? Probably
what you mean is that for every con_exp row, there are foreign keys
referencing the primary keys in your chip and contacts tables? That
gives you the many-to-many relationship and guarantees that you have an
entry in both the contacts and chip tables for every row in the con_exp
table.

Sean

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andrew Hammond 2004-11-02 18:56:12 Re: [SQL] Log
Previous Message Ion Chalmers Freeman 2004-11-02 18:25:40 PREPARE function