Types of Keys
 Primary Key – This is an attribute or set of attributes that
uniquely indentify a specific instance of a record or an entity.
Every entity in the database must have a primary key whose value
uniquely identifies instances or records of the entity.
Features of the primary key are:
- It must have a non – null value for each instance
- The value must be unique
- The value must not change or become null during the life of each
entity instance
 Candidate Key – In some instances, an entity will have more
than one attribute that can serve as a primary key. Any key or
minimum set of keys that could be a primary key is called a
candidate key. Choose the identifier most commonly used by
the user as long as it conforms to the properties of the Primary
Key.
 Alternate Key (Secondary Key) – The Candidate Keys which
are not chosen as the Primary Key are known as alternate
keys.
 Composite Key – Sometimes it requires more than one
attribute to uniquely identify an entity. A primary that is made
up of more than one attribute is known as a composite key.
 Foreign Key – A foreign key is an attribute within a child
entity that completes a relationship by identifying the parent
entity. Foreign keys provide a method for maintaining
integrity in the data (called referential integrity) and for
navigating between instances of an entity. Every relationship
in the model must be supported by a foreign key.
TRN STUDENT
ID
LAST NAME FIRST
NAME
COURSE ID
100-000-001 SH-1001 ALLEN ROSENNA CHM-101
100-000-002 SH-1002 ALLWOOD PAULA-ANN BIO-101
100-000-003 SH-1003 BRADY BRIANA CHM-101
100-000-004 SH-1004 BURKE TIANA ICT-101

Types of Database Keys

  • 1.
  • 2.
     Primary Key– This is an attribute or set of attributes that uniquely indentify a specific instance of a record or an entity. Every entity in the database must have a primary key whose value uniquely identifies instances or records of the entity. Features of the primary key are: - It must have a non – null value for each instance - The value must be unique - The value must not change or become null during the life of each entity instance
  • 3.
     Candidate Key– In some instances, an entity will have more than one attribute that can serve as a primary key. Any key or minimum set of keys that could be a primary key is called a candidate key. Choose the identifier most commonly used by the user as long as it conforms to the properties of the Primary Key.  Alternate Key (Secondary Key) – The Candidate Keys which are not chosen as the Primary Key are known as alternate keys.  Composite Key – Sometimes it requires more than one attribute to uniquely identify an entity. A primary that is made up of more than one attribute is known as a composite key.
  • 4.
     Foreign Key– A foreign key is an attribute within a child entity that completes a relationship by identifying the parent entity. Foreign keys provide a method for maintaining integrity in the data (called referential integrity) and for navigating between instances of an entity. Every relationship in the model must be supported by a foreign key.
  • 5.
    TRN STUDENT ID LAST NAMEFIRST NAME COURSE ID 100-000-001 SH-1001 ALLEN ROSENNA CHM-101 100-000-002 SH-1002 ALLWOOD PAULA-ANN BIO-101 100-000-003 SH-1003 BRADY BRIANA CHM-101 100-000-004 SH-1004 BURKE TIANA ICT-101