![]() |
Primary key VS Unique key in SQL Server
Unique Key constraints:
Unique key constraint will provide you a constraint like the column values should retain uniqueness. It will allow null value in the column. It will create non-clustered index by default Any number of unique constraints can be added to a table. Code:
CREATE TABLE EMPLOYEETABLECode:
ALTER TABLE EMPLOYEETABLEPrimary Key: Primary key will create column data uniqueness in the table. Primary key will create clustered index by default Only one Primay key can be created for a table Multiple columns can be consolidated to form a single primary key It wont allow null values. Code:
ALTER TABLE EMPLOYEETABLERegards, Venkatesan Prabu . J |
| All times are GMT +5.5. The time now is 12:59. |