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
 

 

Difference between primary key and unique key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
imain
Warnings : 1

New User


Joined: 25 Jun 2006
Posts: 14
Location: US

PostPosted: Mon Aug 14, 2006 2:37 pm    Post subject: Difference between primary key and unique key
Reply with quote

Hi All,

Can anybody tell me the exact difference between primary key and unique key.

thanks in advance
imain
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon Aug 14, 2006 2:46 pm    Post subject:
Reply with quote

Hi Imain,

For a db2 table primary key can only be 1 but unique key can be more than 1.
Index is created for primary key
Back to top
View user's profile Send private message
neelesht

New User


Joined: 24 Jul 2006
Posts: 99
Location: Los Angeles

PostPosted: Mon Aug 14, 2006 4:08 pm    Post subject:
Reply with quote

Hi Imain,

Primary key can never have value NULL but Unique key can have NULL value.


Enjoy....
Neelesh
Back to top
View user's profile Send private message
cheetz007

New User


Joined: 10 Aug 2006
Posts: 23

PostPosted: Mon Aug 14, 2006 7:44 pm    Post subject:
Reply with quote

Isn't it simpler than that? A primary key is the ONLY "real" key to a table - the table is indexed on the primary key. A unique key is any column or combination of columns that MUST have a unique value. The table may or may not be indexed on a unique key... that's up to the DBA and the usage requirements of a table. In effect, a "key" is nothing more than a value (or values) that can be contained within a column.

Clear as mud?
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
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


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