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.
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
- )
Refer: diff b/n primary key and foreign key
No comments:
Post a Comment