Monday 1 June 2015

difference between primary key and unique key

Primary Key:
  • Can be only one in a table
  • It never allows null values
  • Primary Key is unique key identifier and can not be null and must be unique.
Unique Key:
  • Can be more than one unique key in one table.
  • Unique key can have null values(only single null is allowed).
  • It can be a candidate key
  • Unique key can be null and may not be unique.

No comments:

Post a Comment

How to find table row count?

--Use below query to find table row count select so.name,sp.rows from sys.objects so inner join sys.partitions sp on so.object_id = sp.obj...