Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 1
Types of Keys in Database System
Types of Keys
 Super Key
 Candidate Key
 Primary Key
 Alternate Key
 Composite Key
 Foreign Key
 Unique Key
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 2
Super Key
 An attribute or set of attributes that are required to identifies a
tuple in a relation.
 A Super Key may contain additional attributes that are not
require for unique identification.
 Unique Key-Student_ID
 Super Key:
 {Student_ ID, Student_Name}
 {Studenr_ID, Student_Address}
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 3
Candidate Key
 Candidate Keys are minimal set of Super Key
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 4
Primary Key
 Primary Key is a candidate key chosen by database administrator for
unique identification.
 No Two rows can have the primary key same values.
 Every row must have primary key value
 The primary key value can not be null
 Value in primary key can not be modified.
 Primary Key: PAN No.
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 5
Alternate Key
• Candidate keys other than primary key are called as a alternate
key.
• PK: PAN No.
• Alternate Key: Voter Id No, Passport No
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 6
Composite Key
• Composite key is the one having combination of more than one attribute
to uniquely determine the records/tuples in a table.
• The only condition that is necessary before choosing composite key is,
the attributes which are responsible for forming the composite key must
not be a key individually.
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 7
Foreign Key
• A foreign key is nothing but an attribute that is commonly linked between two
relation using that same attribute and that attribute must be primary key from one
relation.
• Both the relations/tables must contain the same attribute.
• It can be referred as referential integrity
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 8
Unique Key
 Unique key is same as primary key with the difference being
the existence of Null value.
 Unique Key: MemberID
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 9
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 10
All Keys
Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 11

DBMS: Types of keys

  • 1.
  • 2.
    Types of Keys Super Key  Candidate Key  Primary Key  Alternate Key  Composite Key  Foreign Key  Unique Key Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 2
  • 3.
    Super Key  Anattribute or set of attributes that are required to identifies a tuple in a relation.  A Super Key may contain additional attributes that are not require for unique identification.  Unique Key-Student_ID  Super Key:  {Student_ ID, Student_Name}  {Studenr_ID, Student_Address} Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 3
  • 4.
    Candidate Key  CandidateKeys are minimal set of Super Key Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 4
  • 5.
    Primary Key  PrimaryKey is a candidate key chosen by database administrator for unique identification.  No Two rows can have the primary key same values.  Every row must have primary key value  The primary key value can not be null  Value in primary key can not be modified.  Primary Key: PAN No. Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 5
  • 6.
    Alternate Key • Candidatekeys other than primary key are called as a alternate key. • PK: PAN No. • Alternate Key: Voter Id No, Passport No Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 6
  • 7.
    Composite Key • Compositekey is the one having combination of more than one attribute to uniquely determine the records/tuples in a table. • The only condition that is necessary before choosing composite key is, the attributes which are responsible for forming the composite key must not be a key individually. Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 7
  • 8.
    Foreign Key • Aforeign key is nothing but an attribute that is commonly linked between two relation using that same attribute and that attribute must be primary key from one relation. • Both the relations/tables must contain the same attribute. • It can be referred as referential integrity Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 8
  • 9.
    Unique Key  Uniquekey is same as primary key with the difference being the existence of Null value.  Unique Key: MemberID Ms. B.K.Ugale(bharati_ugale@rediffmail.com) 9
  • 10.
  • 11.