You are on page 1of 7

2.

Candidate Key:
Candidate key is a minimal super key, which contains no
extra attributes. It is also called subset of super key.
Example: In the above table:
 SID
 Reg_No
 E-mail
3. Primary Key:
 Primary key is an attribute, which is uniquely
identifies each record with in a table.
 It can’t accept NULL value.
 We can have only one primary key in a table.
SID Reg_No Name Course E-mail
1 2078001 Sagar KC BIT sagar@gmail.com
2 2078002 Binod Karki CE binod@gmail.com
3 2078003 Darshan DC BIT darshan@gmail.com
4 2078004 Sagar KC BScCSIT sagar12@gmail.com

Table: tbl_student

Example: Reg_No is a primary key.


4. Foreign Key:
 Foreign Key is an attribute in the table that is
primary key in another table.
 It can accept multiple null values.
 We can have more than one foreign key in a table.
Example:
Roll No. Name Grade
1 Sita XI
2 Sarita XII

Primary Key tbl_student

Foreign Key

Reg No. Roll No English Computer Account Economics Math

207701 1 45 55 34 76 44
207702 2 76 87 55 65 76
tbl_subject
5. Alternate Key:
All the remaining candidate key which are not selected
as a primary key are called Alternate Key.
SID Reg_No Name Course E-mail
1 2078001 Sagar KC BIT sagar@gmail.com
2 2078002 Binod Karki CE binod@gmail.com
3 2078003 Darshan DC BIT darshan@gmail.com
4 2078004 Sagar KC BScCSIT sagar12@gmail.com

Example:
If we choose Reg_No as a primary key then SID and
Email will become Alternate Key.
Normalization:
Normalization is the process of breaking down
(or decomposing) a complex relation into simple relation.
Normalization reduces data redundancies and helps to
eliminate the data anomalies that result from
redundancies.
Normalization makes more flexible and easier to
maintain. E.F. Codd has introduced few rules for
normalizing the database in 1970 and these rules are
known as the normal forms.
Advantages of Normalization:
 It reduces data redundancy.
 It improves faster sorting and index creation.
 It simplifies the structure of table.
 It improves the performance of the data system.
 It avoids undesirable insertion, update and
deletion anomalies.
 When a row is added to a relation other relation
in a database should not be affected.

You might also like