quick links

Primary Key, Foreign Key and Unique Key

Primary Key

  • Primary key cannot have a NULL value.
  • Each table can have only one primary key.
  • By default, Primary key is clustered index and data in the database table is physically organized in the sequence of clustered index.

Composite Primary Key

  • A Composite primary key is a set of columns whose values uniquely identify every row in a table. For example, in the table, if "Employee_ID" and "Employee Name" together uniquely identifies a row its called a Composite Primary Key

Unique Key

  • Unique Constraint may have a NULL value.
  • Each table can have more than one Unique Constraint.
  • By default, Unique key is a unique non-clustered index.

Foreign Key

  • Foreign key in the table is primary key in another table.
  • We can have more than one foreign key in a table.

About Us

Joomla Web Solution

We love working with PHP, HTML5, CSS3, jQuery and the most-loved content management framework in the world, Joomla!