Key in a Relational Database

Definition of Key in a Relational Database in Network Encyclopedia.

What is Key in a relational database?

Key in a Relational Database is a column (attribute) or group of columns (attributes) used to uniquely identify records in a table of a relational database such as those created and managed by Microsoft SQL Server.

Key in a Relational Database
Key in a Relational Database

There are two main types of database keys:

  • Primary keys, which uniquely identify the rows of a table. Each row has a unique value in the primary key column or columns. Each table in a relational database should have one and only one primary key, and primary keys cannot allow nulls (NN), duplicates (ND), or no changes (NC).
  • Foreign keys, which are columns or groups of columns within a table that match the primary key of a different table. Foreign keys are used to define relationships between tables and to enforce referential integrity in a database by ensuring that each value in the foreign key column is actually a valid entry in the primary key column of another table.


A column in a database table can be both a primary key for its own table and a foreign key for a different table.


Articles posted after being checked by editors.

Recent Posts

link to Root


Root is the base of a hierarchical file system. It can also be the UNIX superuser or the CERN Data Analysis Framework, and more. Just read the article.