Re: Primary Keys and Foreign Keys

From: Bert Blink <bblink_at_pcug.org.au>
Date: Mon, 14 Apr 2003 01:20:17 GMT
Message-ID: <p43k9v03h6fh5tkhrn2b7trv9i1reuhh1k_at_4ax.com>


On Sun, 13 Apr 2003 22:59:28 GMT, Bert Blink <bblink_at_pcug.org.au> wrote:

>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?

Ooops YES (forgot first time)

>>Do I need to set Person_ID in Person and House_ID in House as a foreign key
>>to reference the composite key in 'Lives'?
>
>No the other way round Person_ID as a foreign key in Lives referencing
>Person & House_ID as a foreign key in Lives referencing House.
>
>
>>
>>Please could someone help answer these questions
>>
>>Thank you
>>David
>>
>>
>>
>
>PO Box 720
>Belconnen ACT 2616 Australia
>+61+2+ 62541341 (h)
> 0427 541344 (mobile)

PO Box 720
Belconnen ACT 2616 Australia
+61+2+ 62541341 (h)
  0427 541344 (mobile) Received on Mon Apr 14 2003 - 03:20:17 CEST

Original text of this message