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

From: Brian Selzer <brian_at_selzer-software.com>
Date: Wed, 22 Feb 2006 01:27:06 GMT
Message-ID: <K5PKf.36020$F_3.29892_at_newssvr29.news.prodigy.net>


A superkey is a set of attributes which uniquely identifies a tuple in a relation.

A candidate key is an irreducible set of attributes which uniquely identifies a tuple in a relation.

A composite key is a candidate key that has more than one attribute.

The primary key is a candidate key. Any candidate key can be the primary key, but usually the candidate key that participates in referential constraints is designated as the primary key.

(a) is imprecise. A collection is different from a set: it's a multiset. Also, a candidate key must be irreducible, meaning that if any of the attributes are excluded, the remaining attributes do not uniquely identify a tuple.

(b) is incorrect. The database designer, not the DBMS, chooses which candidate key is primary. In addition, a candidate key can have more than one attribute, so it's possible to have a composite primary key.

I've addressed (c) above.

A candidate key is a superkey, but a superkey is not necessarily a candidate key. A superkey may be reducible, meaning that even if one or more attributes are excluded, the remaining attributes still uniquely identify a tuple.

"Abhishek" <abhisheksgumadi_at_gmail.com> wrote in message news:1140522359.762187.213930_at_o13g2000cwo.googlegroups.com...
> Hi,
> Can anybody tell me the differences between the above mentioned terms?
> Also please tell me if one can be the other and vice versa..please
> elaborate with the helpof a table if possible. Also please tellme if
> the below statement by me is correct..
> a) Any attribute or a collection of attributes which uniquely
> identifies the tuples in a relation is called a canditate key.this
> candidate key thus can contain a single attribute or a collection of
> attributes.
> b) one of the attributes is chosen by the DBMS to identify the tuples
> uniquely and this attribute is called the primary key.
> c) A primarykey is a candidate key.all candidate keys cannot be a
> primary key.
> Now,,,what is the superkey?
>
Received on Wed Feb 22 2006 - 02:27:06 CET

Original text of this message