Key in a Database Management System



Key in a database management system

  • Key

A key is a single attribute or a set of attributes which is used uniquely locate a tuple in a relation.)
No two tuples or rows in a relationship should be the same. Each row must be different from all other rows. That is, the data in one row of a table must not be the same as that in any other row of the table. Thus, there must be at least one field in a relationship that makes each row of the data different from other rows. However, there can be more than one field in a relationship that makes each row of the data different from other rows. The attribute or set of attributes that are different for each row is the key to the relation.

Keys are important for designing a database system for many reasons. Some of which are:
  • key ensures that each record in a relation is uniquely identified.
  • keys are used to establish relationships among relations.
  • keys are used to establish and enforce data integrity.

  • Primary Key

The primary key is an attribute or a set of attributes that uniquely identify a row in a relation. Every relation in a database management system must have a primary key.

To be a primary key for a relation, an attribute must have the following properties:
  • it must not have a null value in any row in the relation,
  • its value must be unique for each row in the relation, and
  • its attribute value must not change or become null during any database operation.




Post a Comment

0 Comments