Difference b/w Artificial & Secondary & Foreign Keys



  • Artificial Keys

An artificial key is one that has no meaning to the data contained in the relation. It is usually added by the database management system. It is usually used when
  • no attribute or a set of attributes can be used as the primary key, or
  • the primary key is large and complex.

  • Secondary Keys

Sometimes applications need to access and process records by a key that is different from the primary key. This key that is used only for accessing data in a relation is called a secondary key)

It is important to note that a secondary key does not need to have unique values in a table. In this respect, secondary keys are different from primary keys and candidate keys.

  • Foreign  Keys

Foreign  Keys An attribute in a relationship that is a primary key in another relation is called the foreign key.

The relation that contains a foreign key is called the dependent relation. The relation to which a foreign key refers is called the parent relation.

A foreign key - primary key pair is used to establish relationship ween two relations. It also helps in maintaining the integrity of data.

Post a Comment

0 Comments