Re: Primary Keys and Foreign Keys

From: Mike Sherrill <MSherrill_at_compuserve.com>
Date: Tue, 15 Apr 2003 17:59:33 -0400
Message-ID: <5l1m9vs9uc4626g3en1h9cn1fmp9a0df1c_at_4ax.com>


On Sun, 13 Apr 2003 17:08:23 +0100, "David" <no_at_e-mail.com> wrote:

>I am trying to write SQL statements for the following tables.
>
>Person (Person_ID, Name, Age, Interests)
>House (House_ID, Name/Number, Address, City)
>Lives (Person_ID,House_ID, Time_Lived_At_House)
>
>In the 'Lives' table, I have defined Person_ID and House_ID as a composite
>primary key, is this correct?

It depends. What you've done means that a person can live in a particular house once and only once. That might be true for you, but it's not true in the general case.

-- 
Mike Sherrill
Information Management Systems
Received on Tue Apr 15 2003 - 23:59:33 CEST

Original text of this message