View Single Post

  #3 (permalink)  
Old 10-21-2005
Chris Nestrud
 
Posts: n/a
Default Re: Compound and foreign keys

On Fri, 21 Oct 2005 20:39:44 +0200, Jimi Hullegård
<ask_for_real_email@nothotmail.com> wrote:
[snip]
>
> Today I had an exam test for a course about data storage and processing,
> with 20 true/false statements.
>
> One of the statements was (translated from swedish):
> "A compound key is a primary key based on at least two foreign keys."
>
> I answered "False", but in the the published key answers they say "True".
>
>
>
> What do you say about this? Do I really need two foreign keys to create a
> compound key?
>


It is possible to create a primary key using two columns. For example,
you might have a table with Month, Year, and Hits as columns. Month and
Year are not unique but can be when taken together (you won't have a
repeat of Month 10 and year 2005 for example). I have usually seen such
a key identified as a Composite Primary Key.
--
Chris Nestrud
Email: ccn@panix.com
http://www.panix.com/~ccn/
Reply With Quote