0% found this document useful (0 votes)
119 views8 pages

Database Keys

1) A super key is one or more fields that can uniquely identify a record in a table. It includes primary keys, unique keys, and alternate keys. 2) A candidate key is one or more fields that can uniquely identify a record and there can be multiple candidate keys in a table, with only one being selected as the primary key. 3) The primary key uniquely identifies records in a table and cannot contain null or duplicate values. It must be a candidate key.

Uploaded by

M.Faizan Usman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views8 pages

Database Keys

1) A super key is one or more fields that can uniquely identify a record in a table. It includes primary keys, unique keys, and alternate keys. 2) A candidate key is one or more fields that can uniquely identify a record and there can be multiple candidate keys in a table, with only one being selected as the primary key. 3) The primary key uniquely identifies records in a table and cannot contain null or duplicate values. It must be a candidate key.

Uploaded by

M.Faizan Usman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Database Keys

SUPER KEY
 Super key is a set of one or more than one keys that can be
used to identify a record uniquely in a table.

 Primary key, Unique key, Alternate Key are subset of


Super Keys
 E.g. of Super Key

ID , ID, Name , ID, Address , ID, Department_ID,


ID, Salary , Name, Address , Name, Address,
So on as any combination which can identify the records
uniquely will be a Super Key
Candidate Key
 A candidate key is a set of one or more fields/columns that
can be identify a record uniquely in a table. There can be
multiple Candidate Keys in one table. Each Candidate key
can work as Primary Key.

 E.g. of Primary Key


Student ID, Registration Number, and RollNo. are
Candidate Keys since all there fields can be work as
Primary Key.
Primary Key
 Primary Key is a set of one or more fields/columns of a
table that uniquely identify a record in database table. It
can not accept null, duplicate values. Only one Candidate
Key can be Primary Key

 E.g. of Primary Key


Student ID, Registration Number, and RollNo. are
Candidate Keys any one can be select as Primary Key
Alternate Key
 An Alternate Key is a key that can be work as a primary
key. Basically it is a Candidate Key that currently is not
Primary Key.
 E.g. of Alternate Key

Registration Number, and RollNo. becomes Alternate


Keys when we defined Student ID as Primary Key.
Composite Key
 Composite Key is a combination of more than one
fields/columns of a table. It can be a candidate Key,
Primary Key
Unique Key
 Unique Key is a set of one or more fields/columns of a
table that uniquely identify a record in database table. It is
like Primary Key but it can be only one null value and it
can not have duplicate values.
Foreign Key
 Foreign Key is a field in database table that is Primary
Key in another table. It can accept multiple null, duplicate
values.

 E.g. of Foreign Key


If we have a DeptID column in the Employee table which
is pointing to DeptID column in a Department table where
it is Primary Key.

You might also like