• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
May 06, 2022 |55.4K Views

Types of Keys in DBMS

  Share  2 Likes
Description
Discussion

A key is an attribute or a set of attributes in a relation that identifies a tuple (a record) in a relation. In this video, we will see different types of keys in DBMS.
Basically, the keys are defined in a table to access or sequence the stored data quickly and smoothly. They are also used to create states between different tables.

1) Super Key: Super Key is an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. All super keys cannot be candidate keys. In a relation, number of super keys are more than number of candidate keys.

2) Candidate Key: The minimal set of attributes that can uniquely identify a tuple in database is known as a candidate key.

3) Primary Key: There can be more than one candidate key in relation out of which one can be chosen as the primary key. For Example, Enrollment_number in a student database is a primary key.

4) Alternate Key: The candidate key other than the primary key is called an alternate key.

5) Foreign Key: If an attribute can only take the values which are present as values of some other attribute, it will be a foreign key to the attribute to which it refers.

The relation which is being referenced is called referenced relation and the corresponding attribute is called referenced attribute and the relation which refers to the referenced relation is called referencing relation and the corresponding attribute is called referencing attribute. The referenced attribute of the referenced relation should be the primary key to it.

Related Articles : https://www.geeksforgeeks.org/types-of-keys-in-relational-model-candidate-super-primary-alternate-and-foreign/