Types of Keys :
1. Primary key
2. Candidate key
3. Super key
4. Alternate key
5. Foreign key
6. Composite key
Primary key
A primary key in a table that
uniquely identifies each row and
column or set of columns in the
table. The primary key is an
attribute or a set of attributes that
help to uniquely identify the
tuples(records) in the relational
table. The primary key provides the
means to distinguish one tuple
from all the others in the relation.
Candidate key
A candidate key is a minimal set
of attributes that uniquely
identifies each tuple within a
table. In other words, there
should not be any two rows in a
table that can have the same
values for the columns that are
the part of candidate key. It is
very important for establishing
relationships between tables and
maintaining data integrity
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 can’t be candidate
keys but the reverse is true. In
relation, a number of super keys is
more than a number of candidate
keys.
Alternate key
•All the keys which are not primary
keys are called alternate keys.
•It is a secondary key.
•It contains two or more fields to
identify two or more records.
•These values are repeated.
Foreign key
•It is a key it acts as a primary
key in one table and it acts as
secondary key in another table.
•It combines two or more
relations (tables) at a time.
•They act as a cross-reference
between the tables.
Composite key
A composite key is made by the
combination of two or more
columns in a table that can be
used to uniquely identify each row
in the table.
It acts as a primary key if there is
no primary key in a table.
Two or more attributes are used
together to make a composite
key.
A Presentation of Types of Keys in RDBMS.pptx

A Presentation of Types of Keys in RDBMS.pptx

  • 3.
    Types of Keys: 1. Primary key 2. Candidate key 3. Super key 4. Alternate key 5. Foreign key 6. Composite key
  • 4.
    Primary key A primarykey in a table that uniquely identifies each row and column or set of columns in the table. The primary key is an attribute or a set of attributes that help to uniquely identify the tuples(records) in the relational table. The primary key provides the means to distinguish one tuple from all the others in the relation.
  • 5.
    Candidate key A candidatekey is a minimal set of attributes that uniquely identifies each tuple within a table. In other words, there should not be any two rows in a table that can have the same values for the columns that are the part of candidate key. It is very important for establishing relationships between tables and maintaining data integrity
  • 6.
    Super key Super Keyis an attribute (or set of attributes) that is used to uniquely identifies all attributes in a relation. All super keys can’t be candidate keys but the reverse is true. In relation, a number of super keys is more than a number of candidate keys.
  • 7.
    Alternate key •All thekeys which are not primary keys are called alternate keys. •It is a secondary key. •It contains two or more fields to identify two or more records. •These values are repeated.
  • 8.
    Foreign key •It isa key it acts as a primary key in one table and it acts as secondary key in another table. •It combines two or more relations (tables) at a time. •They act as a cross-reference between the tables.
  • 9.
    Composite key A compositekey is made by the combination of two or more columns in a table that can be used to uniquely identify each row in the table. It acts as a primary key if there is no primary key in a table. Two or more attributes are used together to make a composite key.