Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Diference between unique key and primary key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
praneethgokul

New User


Joined: 06 May 2005
Posts: 20
Location: Bangalore

PostPosted: Mon May 23, 2005 6:32 pm    Post subject: Diference between unique key and primary key
Reply with quote

Hi all,

I got 2 silly doubts on primary key.


1. What happens to data when we disable primary key on data?

2. What is diference between unique key and primary key?

Thanks in advance.
Back to top
View user's profile Send private message
References
chayanath

New User


Joined: 07 Mar 2005
Posts: 6
Location: vijayawda

PostPosted: Mon May 23, 2005 9:19 pm    Post subject:
Reply with quote

hello,

1. I am not sure that word disble do exists interms of a data in table


2. There can be only one primary key for a table
and multiple unique keys.

i hope this can do it for u.

bye
chayanath
Back to top
View user's profile Send private message
sudheer648

Active User


Joined: 23 May 2005
Posts: 97
Location: Chennai

PostPosted: Wed May 25, 2005 6:15 pm    Post subject: Re: Diference between unique key and primary key
Reply with quote

Hi Praneeth,

Answering Your Quetions

1.Disable the Primary key -- am Not pretty sure you can disable the primary key.

2.Difference btn Primary Key and Unique Key is
Primary Key is Unique and NotNull --The values should be unique and should not be Null.
UniqueKey --The Values should be Unique and can be null even
Back to top
View user's profile Send private message
jkbytes

Active User


Joined: 19 Feb 2005
Posts: 142
Location: South Africa

PostPosted: Thu May 26, 2005 9:26 am    Post subject: Re: Diference between unique key and primary key
Reply with quote

Sudheer wrote:

Quote:
Primary Key is Unique and NotNull --The values should be unique and should not be Null.
UniqueKey --The Values should be Unique and can be null even


I agree to his point but you cannot have two null records for a field defined as unique. Coz the unique constraint doesn't allow it.

Thanks & Regards,

JKBYTES
Back to top
View user's profile Send private message
sudheer648

Active User


Joined: 23 May 2005
Posts: 97
Location: Chennai

PostPosted: Fri May 27, 2005 3:22 pm    Post subject: Re: Diference between unique key and primary key
Reply with quote

Hi Bytes,

Only one Null is accepted not the second obviously.it will also treated as an value.

Cheers,
Sudheer
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1