Key field in database

Key field is a field in a record of a data table that contains unique data and separates that record from all other records in the database. Examples of key field are Employee ID, Product ID, Roll No, Account Number, etc. Each key field ensures the following features.

  • Identifies each row or record within the table.
  • Enforce integrity constraint.
  • Establish table relationships.
Key field

Purpose of a key field

The purpose of a key field is to fetch or retrieve records or data-rows from data table according to the condition or any requirement.

A key uniquely identifies each row within the table, because no two rows in a table can have the same key.

Several types of constraints are provided by a key field. For example in case of key field the specific column can’t store duplicate values or null values.

Keys have a significant role to generate relationship among different database tables.

Key is also used to search data from a data table in a database file. For example, we can search a specific student from a large number of students in a database depending on the roll key.

  Types of key field

Database supports the following types of keys.

  • Super Key
  • Minimal Super Key
  • Candidate Key
  • Primary Key
  • Unique Key
  • Alternate Key
  • Composite Key
  • Foreign Key
  • Natural Key
  • Surrogate Key




Related posts :