Difference between Primary Key and Unique Key
In SQL Server, we have two keys which distinctively or uniquely identify a record in the database. Both the keys seems identical, but actually both are different in features and behaviours. In this article, I would like to share the key difference between primary key and unique key. For more help about keys in SQL Server refer the article Different Types of SQL Keys.
Define Primary key and Unique key
CREATE TABLE Employee ( EmpID int PRIMARY KEY, --define primary key Name varchar (50) NOT NULL, MobileNo int UNIQUE, --define unique key Salary int NULL )
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.