0% found this document useful (0 votes)
47 views

2 Ndnormal

dbms

Uploaded by

saran
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

2 Ndnormal

dbms

Uploaded by

saran
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Second normal form (2NF)

Second normal form:


A relation is in second normal form if it is in 1NF and every non key attribute is fully
functionally dependent on the primary key.
A university uses the following relation:
Student(IDSt, StudentName, IDProf, ProfessorName, Grade)
The attributes IDSt and IDProf are the identification keys.
All attributes a single valued (1NF).
The following functional dependencies exist:
1. The attribute ProfessorName is functionally dependent on attribute IDProf (IDProf -->
ProfessorName)
2. The attribute StudentName is functionally dependent on IDSt (IDSt --> StudentName)
3. The attribute Grade is fully functional dependent on IDSt and IDProf (IDSt, IDProf -->
Grade)

Example Second normal form

The table in this example is in first normal form (1NF) since all attributes are single valued.
But it is not yet in 2NF. If student 1 leaves university and the tuple is deleted, then we loose
all information about professor Schmid, since this attribute is fully functional dependent on
the primary key IDSt. To solve this problem, we must create a new table Professor with the
attribute Professor (the name) and the key IDProf. The third table Grade is necessary for
combining the two relations Student and Professor and to manage the grades. Besides the
grade it contains only the two IDs of the student and the professor. If now a student is deleted,
we do not loose the information about the professor.

Third normal form (3NF)


Third normal form:
A relation is in third normal form if it is in 2NF and no non key attribute is transitively
dependent on the primary key.
A bank uses the following relation:
Vendor(ID, Name, Account_No, Bank_Code_No, Bank)
The attribute ID is the identification key. All attributes are single valued (1NF). The table is
also in 2NF.
The following dependencies exist:
1. Name, Account_No, Bank_Code_No are functionally dependent on ID (ID --> Name,
Account_No, Bank_Code_No)
2. Bank is functionally dependent on Bank_Code_No (Bank_Code_No --> Bank)

Example Third normal form


The table in this example is in 1NF and in 2NF. But there is a transitive dependency between
Bank_Code_No and Bank, because Bank_Code_No is not the primary key of this relation. To
get to the third normal form (3NF), we have to put the bank name in a separate table together
with the clearing number to identify it.

You might also like