Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

primary and unique key constraints

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
What is the difference between these two?

Thank you all for your time!

--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Well first off if you have a PRIMARY KEY defined it needs to be UNIQE to begin with.

What other constraints are you inquring about?i.e can it be an int, varchar, text...etc?
 
no, you do not need to define a primary key as unique as well, because a primary key is unique by definition

the main difference is that a primary key may not be null, whereas a unique key may



r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top