dbTalk Databases Forums  

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

comp.databases.theory comp.databases.theory


Discuss What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? in the comp.databases.theory forum.

Reply
 
Thread Tools Display Modes
  #1  
Old   
Abhishek
 
Posts: n/a

Default What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-21-2006 , 06:45 AM






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?




Reply With Quote
  #2  
Old   
Anith Sen
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-21-2006 , 02:52 PM






Quote:
A primarykey is a candidate key.all candidate keys cannot be a primary
key. Now,,,what is the superkey?
http://groups.google.com/group/comp....56494b68634ee7

--
Anith




Reply With Quote
  #3  
Old   
Brian Selzer
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-21-2006 , 08:27 PM



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 (DOT) com> wrote

Quote:
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?




Reply With Quote
  #4  
Old   
Mark Johnson
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-23-2006 , 06:33 PM



"Abhishek" <abhisheksgumadi (AT) gmail (DOT) com> wrote:

Quote:
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.

Quote:
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.

Quote:
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.

Quote:
c) A primarykey is a candidate key.all candidate keys cannot be a
primary key.
Would you say that, now?

Quote:
Now,,,what is the superkey?
And do you have your answer?



Reply With Quote
  #5  
Old   
Mark Johnson
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-23-2006 , 06:44 PM



Mark Johnson <102334.12 (AT) compuserve (DOT) com> wrote:

Quote:
"Abhishek" <abhisheksgumadi (AT) gmail (DOT) 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.
Let me add, if it helps to clarify anything:

Primary key - uniquely identified
Superkey - uniquely identifies at a minimum
Candidate - uniquely identifies
Composite - but only if uniquely identifies
Attribute - ""

Superkey - uniquely identifies, and perhaps then some
Candidate - uniquely identifies
Composite - but only if uniquely identifies
Attribute - ""

Candidate Key - uniquely identifies
Composite - but only if
Attribute - ""

Composite Key - may uniquely identify, may not
more than one Attribute

Attribute - may uniquely identify or not
one Attribute


Reply With Quote
  #6  
Old   
Abhishek
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-24-2006 , 12:56 PM



Now that I have understood the different types of keys and their
differences, can you tell me what is a NON-PRIME ATTRIBUTE? Is it an
attribute which is not a candidate key?
Brian Selzer wrote:
Quote:
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 (DOT) com> wrote in message
news:1140522359.762187.213930 (AT) o13g2000cwo (DOT) 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?



Reply With Quote
  #7  
Old   
Mikito Harakiri
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-24-2006 , 01:05 PM



Abhishek wrote:
Quote:
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?
There is no formal distinction between them. Therefore, let's speak of
unique key or just a key. Formally, a key is a functional dependence
from a set of attributes to the whole relation header.



Reply With Quote
  #8  
Old   
Mikito Harakiri
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-24-2006 , 01:13 PM




Mikito Harakiri wrote:
Quote:
Abhishek wrote:
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?

There is no formal distinction between them. Therefore, let's speak of
unique key or just a key. Formally, a key is a functional dependence
from a set of attributes to the whole relation header.
To clarify, I don't really understand why some property totally
unrelated to uniquness has to be a part of key name. For example, what
irreducibility of the number of attributes has to do with uniqueness?
Or attribute participation in referential integrity constraint?



Reply With Quote
  #9  
Old   
Marshall Spight
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-24-2006 , 01:16 PM



Mikito Harakiri wrote:
Quote:
There is no formal distinction between them. Therefore, let's speak of
unique key or just a key. Formally, a key is a functional dependence
from a set of attributes to the whole relation header.
This is nice and simple, but it slightly bothers me that in most cases,
this describes an FD that has attributes on both the left and right
side of the arrow. (Not that there is anything wrong with that, but
perhaps there is some value to excluding the trivial depedencies?)

What would you say to:

A functional dependency X -> Y, where X and Y are disjoint sets of
attributes, is a key if X union Y = relation header.

Is it always possible to uniquely normalize the set of functional
dependencies such that there are no trivial dependencies?


Marshall



Reply With Quote
  #10  
Old   
Mikito Harakiri
 
Posts: n/a

Default Re: What are the differences between the terms, CANDIDATE KEY, PRIMARY KEY, SUPER KEY, COMPOSITE KEY? - 02-24-2006 , 01:44 PM






Marshall Spight wrote:
Quote:
Mikito Harakiri wrote:

There is no formal distinction between them. Therefore, let's speak of
unique key or just a key. Formally, a key is a functional dependence
from a set of attributes to the whole relation header.

This is nice and simple, but it slightly bothers me that in most cases,
this describes an FD that has attributes on both the left and right
side of the arrow. (Not that there is anything wrong with that, but
perhaps there is some value to excluding the trivial depedencies?)
I think you have it backwards. A trivial FD is

header -> any set of attributes

not

a set of attributes -> header



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.