Unique key vs primary key

Primary Key:
  • Can be only one in a table
  • It never allows null values
  • Primary Key is a unique key identifier and can not be null
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

Comments

Popular posts from this blog

EJB - Stateful vs Stateless

Mirror binay tree - Java