GeekInterview.com
Series: Subject: Topic:
Question: 189 of 427

what is the difference between a candidate key and a primary key?

Asked by: lokaiah.p | Member Since Jan-2007 | Asked on: Apr 30th, 2007

View all questions by lokaiah.p

Showing Answers 1 - 6 of 6 Answers

A candidate key is one which can be used as primary key that is not null and unique constraint both holding true. In short all primary keys are definitely candidate keys. That is one of the candidate keys is chosen as primary key.

  
Login to rate this answer.
ravi

Answered On : May 12th, 2007

Candidate key is a Unique Key and it can be used to find out any purticular Tuple(row) in a table..a Primary key is also a Candidate Key... But these are the diff..1)on a table we can have only 1 primary key but 'N' number of unique keys.2)Unique key can be null but not a Primary key

Yes  1 User has rated as useful.
  
Login to rate this answer.
SUKANYA

Answered On : Sep 16th, 2011

Primary key-Primary is assign to that column whose values should be unique
Example-- roll no column in a class table there can be 2 person with same name so this column cannot be primary key because all value should be unique but the roll will be given unique to every student.

Unique key-The logic is same the value should be unique but the vale can be null but in primary key the value cannot be null.

Candidate key-There will be possibilities where 2 column may be unique but we can assign only one primary key so the other column is the candidate key as it can also be the primary key.

  
Login to rate this answer.
V.Lijina

Answered On : Sep 28th, 2011

The main purpose of candidate key : from candidate key the user can choose the best primary key,we can have multiple candidate key but only one primary key

  
Login to rate this answer.

Primary key defines the uniqueness of a row. there should be no null value in primary key.

The keys which are opt for primary key known as candidate keys. In a table candidate keys are the candidates for the primary key. Hence the selected one is called primary key and the remaining ones are called as alternate keys.

  
Login to rate this answer.
ashok panguluri

Answered On : Feb 11th, 2012

Primary key: The key which is unique and not allow the null values nothing but primary key. Each table contain only one primary key.

Candidate key: The key which is opt for the primary key is nothing but candidate key, the table can contain number of candidate key as per requirement.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.