Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - What diffrence between Candidate And Primary Key
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

What diffrence between Candidate And Primary Key

 Post Reply Post Reply
Author
devat View Drop Down
Newbie
Newbie
Avatar

Joined: 16 June 2007
Location: United States
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote devat Quote  Post ReplyReply Direct Link To This Post Topic: What diffrence between Candidate And Primary Key
    Posted: 16 June 2007 at 1:03pm
hi dear all

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

Thanks


Edited by devat - 16 June 2007 at 1:05pm
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2007 at 5:59pm
Back to Top
codeguru View Drop Down
Newbie
Newbie


Joined: 23 August 2007
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote codeguru Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
vbsqluser View Drop Down
Newbie
Newbie


Joined: 05 November 2007
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote vbsqluser Quote  Post ReplyReply Direct Link To This Post 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.
 

  


Edited by vbsqluser - 06 June 2013 at 6:43am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.