Key Concept

Keys are very important part of Relational database. They are used to establish and identify relation between tables. They also ensure that each record within a table can be uniquely identified by combination of one or more fields within a table.


Super Key

Super key stands for superset of a key.
A Super Key is a set of one or more attributes that are taken collectively and can identify all other attributes uniquely.
OR
Super Key is defined as a set of attributes within a table that uniquely identifies each record within a table.


Candidate Key

Candidate Keys are super keys for which no proper subset is a super key. In other words candidate keys are minimal super keys.Candidate keys are defined as the set of fields from which primary key can be selected. It is an attribute or set of attribute that can act as a primary key for a table to uniquely identify each record in that table.


Primary Key

Primary key is a candidate key that is most appropriate to become main key of the table. It is a key that uniquely identify each record in a table.
It is a candidate key that is chosen by the database designer to identify entities with in an entity set. Primary key is the minimal super keys. In the ER diagram primary key is represented by underlining the primary key attribute. Ideally a primary key is composed of only a single attribute. But it is possible to have a primary key composed of more than one attribute.

primary-key


Composite Key

Key that consist of two or more attributes that uniquely identify an entity occurance is called Composite key consists of more than one attributes.
Example: Consider a Relation or Table R1. Let A,B,C,D,E are the attributes of this relation.

R(A,B,C,D,E)
A→BCDE This means the attribute ‘A’ uniquely determines the other attributes B,C,D,E.
BC→ADE This means the attributes ‘BC’ jointly determines all the other attributes A,D,E in the relation.

Primary Key :A
Candidate Keys :A, BC
Super Keys : A,BC,ABC,AD

ABC,AD are not Candidate Keys since both are not minimal super keys.


Secondary or Alternative key

The candidate key which are not selected for primary key are known as secondary keys or alternative keys


Non-key Attribute

Non-key attributes are attributes other than candidate key attributes in a table.


Non-prime Attribute

Non-prime Attributes are attributes other than Primary attribute.


Admin has written 171 articles

Leave a Reply