What are the difference between a primary key and a unique key?

What are the difference between a primary key and a unique key?

Primary key and a Unique key enforce unique value of the column on which they are defined.

Main difference between them is that, primary key doesn’t allow any NULLs, but unique key allows one NULL only, and another difference is by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + 6 =


All Rights Reserved 2019 | DesignzRush (OPC) Pvt. Ltd.
Inline
Inline