Re: Primary Keys and Foreign Keys
Date: Mon, 14 Apr 2003 09:38:42 +0100
Message-ID: <3e9a76b4$0$958$cc9e4d1f_at_news.dial.pipex.com>
"Bert Blink" <bblink_at_pcug.org.au> wrote in message
news: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.
Thank you
David
Received on Mon Apr 14 2003 - 10:38:42 CEST