Database System Keys List with Definition

Database is the backbone of any software or application. Here you can find Database System Keys List with Definition for basic understanding of Database System Keys.

Database System Keys List with Definition

Database System Keys List

Super Key:

A Super key is any combination of fields within a table that uniquely identifies each record within that table.

Candidate Key:

A candidate is a subset of a super key. A candidate key is a single field or the least combination of fields that uniquely identifies each record in the table. The least combination of fields distinguishes a candidate key from a super key. Every table must have at least one candidate key but at the same time can have several.

  • It must contain unique values
  • It must not contain null values
  • It contains the minimum number of fields to ensure uniqueness
  • It must uniquely identify each record in the table

Primary Key:

A primary key is a candidate key that is most appropriate to be the main reference key for the table. As its name suggests, it is the primary key of reference for the table and is used throughout the database to help establish relationships with other tables.

Foreign Key:

A foreign key is generally a primary key from one table that appears as a field in another where the first table has a relationship to the second.

In other words, if we had a table A with a primary key X that linked to a table B where X was a field in B, then X would be a foreign key in B.

Secondary Key or Alternative Key:

A table may have one or more choices for the primary key. Collectively these are known as candidate keys as discuss earlier. One is selected as the primary key. Those not selected are known as secondary keys or alternative keys.

Also Read: SQL Database Glossary

Simple Key:

Any of the keys described before (ie primary, secondary or foreign) may comprise one or more fields, for example if firstName and lastName was our key this would be a key of two fields where as studentId is only one.

Compound Key:

A compound key consists of more than one field to uniquely identify a record. A compound key is distinguished from a composite key because each field, which makes up the primary key, is also a simple key in its own right.

Composite Key:

A composite key consists of more than one field to uniquely identify a record. This differs from a compound key in that one or more of the attributes, which make up the key, are not simple keys in their own right.

Leave a Reply