What is the difference between Primary key and Unique Key?
Primary exists in database table while unique key exists in internal tables. We can perform actions like sorting, searching, modifying, updating on the basis of primary in the database table. Same actions can be performed with unique key in the internal tables. Internal tables with a unique key cannot contain duplicate entries. The uniqueness depends on the table access method.
Both primary key and unique key enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn’t allow NULLs, but unique key allows one NULL only.