Re: Primary Keys and Foreign Keys
Date: Sun, 13 Apr 2003 22:59:28 GMT
Message-ID: <3rqj9v40em7c85ep0csrn3t4bu2kg39bdu_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?
>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)
Received on Mon Apr 14 2003 - 00:59:28 CEST
