Popular Posts

Sunday, April 26, 2015

Primary, Unique & Foreign key - what is difference between them

SQL / database Interview Questions:

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: