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

Difference between primary key and unique key


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

PostPosted: Mon Aug 14, 2006 2:46 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


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 Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts Cobol prog to put an indicator on the... JCL & VSAM 1
Search our Forums:

Back to Top