Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
REGARDING PRIMARY KEY AND UNIQUE KEY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
ashwinreddy

Active User


Joined: 16 Sep 2004
Posts: 107
Location: Hyderabad

PostPosted: Tue Oct 05, 2004 1:17 pm    Post subject: REGARDING PRIMARY KEY AND UNIQUE KEY
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
References
anuradha

Global Moderator


Joined: 06 Jan 2004
Posts: 257

PostPosted: Tue Oct 05, 2004 1:32 pm    Post subject:
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: 18

PostPosted: Fri Oct 15, 2004 2:45 pm    Post subject:
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    Post subject: Re: REGARDING PRIMARY KEY AND UNIQUE KEY
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    Post subject: Re: REGARDING PRIMARY KEY AND UNIQUE KEY
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

Active User


Joined: 30 Jul 2004
Posts: 98

PostPosted: Mon Nov 08, 2004 10:44 am    Post subject: Re: REGARDING PRIMARY KEY AND UNIQUE KEY
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    Post subject: hi ashwin
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1