954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

candidate key

Hi All,

How to add a candidate key in a table in SQl??

Please Help.

Thanks.

Piya27
Junior Poster
112 posts since Jun 2009
Reputation Points: 22
Solved Threads: 9
 

m not really sure but i think candidate key is the column which qualifies to be a primary key.
so u can set this column as primary key if u wish to at a later date.
but i dont think you can assign a candidate key

babbu
Posting Whiz in Training
208 posts since Jun 2009
Reputation Points: -1
Solved Threads: 23
 
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

What I actually want is to make one key of my table as candidate key.
I used keyword UNIQUE also but I was not able to accomplish the task.
Pls suggest.

Piya27
Junior Poster
112 posts since Jun 2009
Reputation Points: 22
Solved Threads: 9
 

set Primary key.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 
set Primary key.

But Sir, I don't want to set the key as primary key..

Actually, I am sorry not to tell my problem in detail..

Specifically, I have a table with enrolno as primary key and I want to make classid As Candidate key, because I want to reference ClassID from a foreign key of another table. For that when I use the query to set FOREIGN KEY constraint that refers to the classid of this table,i get the error asking for classid to be either primary or candidate key..

Piya27
Junior Poster
112 posts since Jun 2009
Reputation Points: 22
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You