Print Page | Close Window

What diffrence between Candidate And Primary Key

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=23542
Printed Date: 28 March 2026 at 2:20pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: What diffrence between Candidate And Primary Key
Posted By: devat
Subject: What diffrence between Candidate And Primary Key
Date Posted: 16 June 2007 at 1:03pm
hi dear all

give me idea for what's difference Candidate key and Primary Key ?

Thanks


-------------
New Ousourcing Company Web sites Launched in India/USA Regions
source:http://www.sharpsourcing.com/
Website Design Los angeles (http://www.avileax.com)



Replies:
Posted By: michael
Date Posted: 21 June 2007 at 5:59pm
http://google.com - Definition: A candidate key is a combination of attributes that can be uniquely used to identify a database record without any extraneous data. Each table may have one or more candidate keys. One of these candidate keys is selected as the table primary key.


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: codeguru
Date Posted: 12 September 2007 at 6:47am

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.



-------------
www.coderewind.com
Best Place to hunt for Code


Posted By: vbsqluser
Date Posted: 05 November 2007 at 7:56am
Hi,
 
Candidate key:
 
It is important to have an attribute in a table that uniquely identifies a row. An attribute or set of attributes that uniquely identifies a row is called a Candidate key. This attribute has values that are unique. Consider the table Vehicle. The values of the attributes Serial#, Regn# and description are unique in every row. Therefore, all three are Candidate keys. A candidate key can also be referred to as a Surrogate key.
 
Primary key:
 
The candidate key that you choose to identify each row uniquely is called the primary key. In the table Vehicle, if you choose Serial# to identify rows uniquely is called the primary key. 
 
Alternate Key:
 
A Candidate key that is not chosen as a primary key is an alternate key. In the table Vehicle, if you choose SErial# as the Primary key, Regn# is the Alternate key.
 
It is important that you understand  that a primary key is the only sure way to identify the rows of a table. Hence, an alternate key may have the value NULL. A NULL value is not to be permitted in the primary key since it would be difficult to uniquely identify rows containing NULL values.
 
Hope this helps.
 

  



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net