IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Diference between unique key and primary key


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
praneethgokul

New User


Joined: 06 May 2005
Posts: 20
Location: Bangalore

PostPosted: Mon May 23, 2005 6:32 pm
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
chayanath

New User


Joined: 07 Mar 2005
Posts: 6
Location: vijayawda

PostPosted: Mon May 23, 2005 9:19 pm
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

New User


Joined: 23 May 2005
Posts: 97
Location: Chennai

PostPosted: Wed May 25, 2005 6:15 pm
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: 139
Location: South Africa

PostPosted: Thu May 26, 2005 9:26 am
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

New User


Joined: 23 May 2005
Posts: 97
Location: Chennai

PostPosted: Fri May 27, 2005 3:22 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Cobol prog to put an indicator on the... JCL & VSAM 1
No new posts Any JCL or VSAM Utility to get number... JCL & VSAM 1
No new posts Can we Insert duplicates in Primary U... DB2 2
Search our Forums:

Back to Top