Geeks Talk

Prepare for your Next Interview




Candidate key

This is a discussion on Candidate key within the Oracle forums, part of the Databases category; What is a candidate key in oracle? What is difference between candidate key, primary key and unique key?...


Go Back   Geeks Talk > Databases > Oracle

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 06-13-2008
Contributing Member
 
Join Date: Mar 2008
Posts: 81
Thanks: 14
Thanked 3 Times in 3 Posts
babi_geek is on a distinguished road
Candidate key

What is a candidate key in oracle?
What is difference between candidate key, primary key and unique key?
Reply With Quote
The Following User Says Thank You to babi_geek For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 06-14-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: Candidate key

A candidate key uniquely identifies rows in the table.
Any of identified candidate keys can be used as primary key.
Candidate keys that are not part of primary key are called alternate keys.

Primary key will not allow duplicate values and null values.

Foreign key is used to enforce referencial integrity.
Reply With Quote
  #3 (permalink)  
Old 06-14-2008
Contributing Member
 
Join Date: Mar 2008
Posts: 81
Thanks: 14
Thanked 3 Times in 3 Posts
babi_geek is on a distinguished road
Re: Candidate key

You are saying "any of identified candidate keys can be used as primary key."

Does it mean a candidate key must always satisfy the following two conditions

1. Duplicate values are not allowed
2. Null values are not allowed.


But a table can have only one primary key. If each candidate key is a primary key then it is allowing more than one primary key on a table.

Still I did get clear idea about candidate key.

Please clarify it.
Reply With Quote
  #4 (permalink)  
Old 06-14-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: Candidate key

In other words Candidate keys are all columns in a table that are not dependent on other columns in the table.

All candidate keys are not primary keys. we choose one of the candidate keys as primary key. A table may contain more than one candidate key but only one primary key column per table is allowed.

I hope now it is clear.
Reply With Quote
  #5 (permalink)  
Old 07-10-2008
Junior Member
 
Join Date: Jul 2008
Location: Toronto
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
jmorecroft is on a distinguished road
Re: Candidate key

I understand what a candidate key is. Can somebody tell me what the syntax is to create one?
Reply With Quote
  #6 (permalink)  
Old 10-06-2008
Junior Member
 
Join Date: Oct 2008
Location: AHMEDABAD
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
sunshine60india is on a distinguished road
Re: Candidate key

Set of fields in database taken collectively to identify any row uniquely is called Candidate key...
So Database has more than 1 Candidate key...

Primary key is the Candidate key choosen by the Database Designer...
Unique Key is the constraint that is used to insert unique value in the field of the database...


Thanks ,, Vipul Patel
Reply With Quote
Reply

  Geeks Talk > Databases > Oracle


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Reservation in HAL for PH candidate Geek_Guest QTP 0 10-12-2007 04:45 PM


All times are GMT -4. The time now is 02:37 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved