In SQL Server, we have two keys which distinctively or uniquely identify a record in the database. Both the keys seem identical, but actually, both are different in features and in behaviours. In this article, I would like to share the key differences between primary key and unique key.
For more help about keys in SQL Server refer the article Different Types of SQL Keys.
Difference between Primary Key and Unique Key
Defining Primary key and Unique key in SQL Server
CREATE TABLE Employee ( EmpID int PRIMARY KEY, --define primary key Name varchar (50) NOT NULL, MobileNo int UNIQUE, --define unique key Salary int NULL )Read More Articles Related to sqlserver
I hope you will enjoy these tricks while programming with SQL Server. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.