Re: Table acting as a relation table
Date: 10 Apr 2007 16:47:01 -0700
Message-ID: <1176248821.606596.203310_at_l77g2000hsb.googlegroups.com>
On Apr 10, 3:32 pm, "Guy" <guh..._at_yahoo.com> wrote:
> I am going to rephrase my question:
>
> T_HOSPITAL <-------------- T_HOSPITAL_CLINIC <-------------> T_CLINIC
> HOSP_CODE HOSP_CODE
> CLINIC_CODE
> CLINIC_CODE
>
> With my asssociation table I can define which clinic belongs to which
> hospital. Someone told me that such table cannot have the only two
> field HOSP_CODE, CLINIC_CODE, but some other "key" field should be
> there. Quote "a table with no key to identify each row should not be
> modeled".
>
> Obviously my table will work as is. Is there however a rule I am
> enfringing ?
If the association table T_HOSPITAL_CLINIC has only the two attributes, HOSP_CODE and CLINIC_CODE, that would not be breaking any rules. (Assuming you use the other constraints as in Bob's earlier message.) If that table already has a key (CLINIC_CODE) then you WOULD be breaking a rule if you added an additional key just to make your "someone" happy.
It is true that every table should have a key.
These things are NOT true:
Every table should have a key that is unique to that table
Every key should be a single column
Every key should be an integer
Sometimes people who have learned how to do things by rote mistakenly end up believing some of the above.
Marshall Received on Wed Apr 11 2007 - 01:47:01 CEST