Talk:Candidate key

From Oracle FAQ
Jump to: navigation, search

there are many types of keys in oracle to identify a row uniquely such as super key,primary key,cnadidate key,composit key,and foreign key.

== super key ==:- all attributes that are select to make a primary key are known as super key.

== primary key ==:-attribute that uniquely identified a row in a table is known as primary key and primary key shuld be unique and not null.

== candidate key ==:-remaining all the keys which are not select to a primary key are known as candidate key(alternate key).

== composit key ==:-when mare than one field choose to make a primary key then, that keys are known as composit key.

== foreign key ==:-to joint two tables we use foreign key that referiences a primary key to an another table.


== for example ==:- suppose there are five attributes in a student table such as:

               college id,name,age,phone no. and address.
you can select all these attributes to make a primary key.these all attributes are called super key.

if we select college id,name and phone no. to make our primary key then is called composit key. remaining keys age and address known as candidate key(alternate key) because they can be selected as primary key.


These are totally artificial. As far as know "super key" does not exist in the norm. The primary key is the subset of attributes that identities a row and is not intend to change. You cannot say that age and address is a candidate key because twins will have the same key. Actually if your table only contains these fields there is no primary key; you have to add first names and also a student_id attribute. In a well designed model, college_id should not be part of the same table as address and so on. There must be an intermediate table between "colleges" ones and "students" ones and this table must contain some dates because people are student of different schools during their life. And so on. Have a look at Normalization page. Michel Cadot 12:18, 9 January 2010 (UTC)