Re: foreign vs primary key

From: Dan Star <danstar_at_engman-taylor.com>
Date: Wed, 19 Sep 2001 16:12:17 -0500
Message-ID: <3ba90b40$0$12824$272ea4a1_at_news.execpc.com>


mikeg wrote:
>
> I have read a number of texts regarding the terms foreign and primary keys
> but I just can't get a feel for their uses.
>
> any help appreciated,
>
> mike

Think of Parent-Child. The foreign key is a key in a table that is the primary key in another table.

E.G.

  Authors Table

     Author_ID, int, primary key
     First_name, char
     Last_name, char
     DOB, date

  Books Table

     ISBN, char, primary key
     Author_ID, int, foreign key (Authors Table)
     Title, char
     Date_published, date
     Category, char

Dan Received on Wed Sep 19 2001 - 23:12:17 CEST

Original text of this message