Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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
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    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

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

New 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: 141
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

New 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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts SFTP to primary and secondary servers mallik4u JCL & VSAM 4 Tue Jun 07, 2016 12:52 pm
No new posts Unique sort situation.... dbecker SYNCSORT 6 Wed Apr 27, 2016 8:53 pm
No new posts Unique Record Count anandhan87 DFSORT/ICETOOL 1 Tue Feb 09, 2016 4:06 pm
No new posts unique 8 character token Pedro CLIST & REXX 9 Fri May 08, 2015 10:59 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us