Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY?

From: Mark Johnson <102334.12_at_compuserve.com>
Date: Thu, 23 Feb 2006 15:33:33 -0800
Message-ID: <cagsv1t95tlhlnh4n23h7b07pjl4612h3c_at_4ax.com>


"Abhishek" <abhisheksgumadi_at_gmail.com> wrote:

>a) Any attribute or a collection of attributes which uniquely
>identifies the tuples in a relation is called a canditate key.

A superkey can be said to begin with all the attributes in a tuple and reduce to those attributes which uniquely identify the tuple. So everything inbetween, as well.

>candidate key thus can contain a single attribute or a collection of
>attributes.

The irreducible superkey, if you will. The candidate key is said to be that which is one or more attributes which uniquely identify the tuple. And these attributes cannot be further pared in any way so that the result would also still uniquely identify that tuple. A composite key would be your 'collection of attributes'. A composite key is more than one attribute.

>b) one of the attributes is chosen by the DBMS to identify the tuples
>uniquely and this attribute is called the primary key.

By the machine? Chosen by the machine? You might be referring to an automatically numbered field, which becomes an artificial primary key, and unique for any tuple in the relation/table, but with no semantic tie at all to the other attributes, that is, if the designer selects it to be the primary key. The machine doesn't do it. If not selected as such, it's just another attribute. The primary key may be one attribute, a composite, a candidate key or superkey. It must uniquely identify the tuple.

>c) A primarykey is a candidate key.all candidate keys cannot be a
>primary key.

Would you say that, now?

>Now,,,what is the superkey?

And do you have your answer? Received on Fri Feb 24 2006 - 00:33:33 CET

Original text of this message