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

REGARDING PRIMARY KEY AND UNIQUE KEY


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

Active User


Joined: 16 Sep 2004
Posts: 106
Location: Hyderabad

PostPosted: Tue Oct 05, 2004 1:17 pm
Reply with quote

Hai

i want difference b/w primary key and unique key.

maximum number of primary key's for a table.

ashwin
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Tue Oct 05, 2004 1:32 pm
Reply with quote

Hi Ashwin,

Unique key in the sense it will not have any value repeated to that particular key but primary key(also unique) makes the total row unique.

Thanks,
Anu
Back to top
View user's profile Send private message
unna

New User


Joined: 15 Oct 2004
Posts: 17

PostPosted: Fri Oct 15, 2004 2:45 pm
Reply with quote

Hi,
I Suppose Primary key and unique key both mean the same .
Primary key is used for unique identification of a row and should not
have null values. There can be only one primary key for a table.

Thanks,
Back to top
View user's profile Send private message
veerababu

New User


Joined: 07 Nov 2004
Posts: 3

PostPosted: Sun Nov 07, 2004 1:44 pm
Reply with quote

The main Difference is that

Primary key means ----- No Duplicates and No Nulls.


Unique key means ------ No Duplicates but Allows Nulls.
Back to top
View user's profile Send private message
veerababu

New User


Joined: 07 Nov 2004
Posts: 3

PostPosted: Sun Nov 07, 2004 1:48 pm
Reply with quote

Hi,

veerababu wrote:
The main Difference is that

Primary key means ----- No Duplicates and No Nulls.


Unique key means ------ No Duplicates but Allows Nulls.



Thanks,

vb
Back to top
View user's profile Send private message
ksivapradeep

New User


Joined: 30 Jul 2004
Posts: 95

PostPosted: Mon Nov 08, 2004 10:44 am
Reply with quote

hello veera babu,

i think another diff b/w pkey and ukey is we can create more than one primary for a table and we cant create more than one ukey for a table is it correct r not.

regards,
siva pradeep
Back to top
View user's profile Send private message
i413678
Currently Banned

Active User


Joined: 19 Feb 2005
Posts: 112
Location: chennai

PostPosted: Sat Feb 19, 2005 2:44 pm
Reply with quote

the difference between unique and primary key is

primary key : notnull and unique

unique key is : avoids duplicates only.

more over one table can have only one primary key but more than one unique indexes.

any thing wrong or missed let me know.

Regards,
Pavan
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