What is the difference between Primary Key and Unique key?

March 16, 2011 | Filed Under MySQL, PHP | Leave a Comment

Both Primary Key and Unique Key enforces uniqueness of the column on which they are defined. But by default Primary Key creates a Clustered Index on the column, where are Unique Key creates a Nonclustered Index by default. Another major difference is that, Primary Key doesn’t allow NULLs, but Unique Key allows one NULL only.

Comments

Leave a Reply





© PHPInterviewQuestion.com 2009 - 2012

eXTReMe Tracker