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 -> DB2
View previous topic :: :: View next topic  
Author Message
rajesh822
Currently Banned

New User


Joined: 22 Sep 2005
Posts: 5

PostPosted: Mon Oct 10, 2005 12:47 am    Post subject: Difference between primary key and unique key
Reply with quote

what is the difference between primary key and unique key?
Back to top
View user's profile Send private message

radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Mon Oct 10, 2005 10:21 am    Post subject:
Reply with quote

Primary Key is Unique and NotNull
UniqueKey --The Values should be Unique and can be null even

for further info on this one,please search the previous posts in this forum.

hope this helps.
Back to top
View user's profile Send private message
SWAPNA LATHA

New User


Joined: 13 Jun 2005
Posts: 3

PostPosted: Sat Oct 15, 2005 4:06 pm    Post subject:
Reply with quote

one more addition to the above question......
if unique key allows null values and more than one record has null entries,then how is uniqueness maintained?????
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Sat Oct 15, 2005 4:35 pm    Post subject: Re: Difference between primary key and unique key
Reply with quote

swapna latha,

Unique can have only one null value.

Pls refer this previous posts.
http://ibmmainframes.com/about5855.html&highlight=unique+key

hope this helps.
Back to top
View user's profile Send private message
SWAPNA LATHA

New User


Joined: 13 Jun 2005
Posts: 3

PostPosted: Mon Oct 17, 2005 10:40 am    Post subject: Unique can have only one null value.
Reply with quote

thanks radhakrishna

this answers my query...
Back to top
View user's profile Send private message
nijugopalan

New User


Joined: 15 Oct 2005
Posts: 15
Location: pune

PostPosted: Thu Oct 20, 2005 7:58 pm    Post subject: Re: Difference between primary key and unique key
Reply with quote

all the keys used in the table which have unique values are unique keys.while the unique key which is selected to identify records is the primary key while all other keys are alternate keys.

ALL PRIMARY KEYS ARE UNIQUE KEYS WHILE ALL PRIMARY KEYS CANNOT BE AN UNIQUE KEYS.

THIS IS CORRECT NAA. MY FREINDS. icon_lol.gif
Back to top
View user's profile Send private message
ravisan
Warnings : 1

New User


Joined: 13 Sep 2005
Posts: 13
Location: chennai

PostPosted: Mon Oct 24, 2005 3:08 pm    Post subject: Diferr p.k-u.k - SQL
Reply with quote

One more differance is there......

A table may contains no of unique key. But it must contains only a primery key


Regards,
Ravisan
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Wed Oct 26, 2005 6:27 pm    Post subject: unique- primary- diff
Reply with quote

hi frnd,
the primary key is let active when any the unique index is create. its same like unique value. ie., the unique key can have only one null value and it cannot have any foreign key ref. as the primary key cannot have a null value and can have ref to any foreign key. hope enough
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 How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
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


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