Differences:
1)Both primary key and unique key enforces Uniqueness
2)primary key doesn't allow any one NULL value,where the unique allow one NULL value. If the unique key is defined in a combination of fields, then every field can accept NULL and can have some values on them, as long as the combination values is unique.
3)we can create only one primary key on a table,but we can create more than one unique key on a table.
4)By default primary key creates clustered index where as unique key creates non-clustered index.
1)Both primary key and unique key enforces Uniqueness
2)primary key doesn't allow any one NULL value,where the unique allow one NULL value. If the unique key is defined in a combination of fields, then every field can accept NULL and can have some values on them, as long as the combination values is unique.
3)we can create only one primary key on a table,but we can create more than one unique key on a table.
4)By default primary key creates clustered index where as unique key creates non-clustered index.
No comments:
Post a Comment