Different Normal Forms
Different Normal Forms
The relation Student is not in first normal form (1 NF) as the attribute phone number is
multivalued and non atomic
To make the relation Student compiles with 1NF , we have the organize the data such way that
the relation has no non atomic values.
Following Relation in 1 NF
Student
Example:
Relation R1 = (EmpID, ProjID, Days)
Here, an employee can work more than one projects and more than one employees can work on a
project
Therefore, candidate key is (EmpID, ProjID)
Emp_Proj
2NF applies only to relations with composite primary keys, that is, relations
with a primary key composed of two or more attributes
A 1NF relation with a single primary key is automatically in at least 2NF
2NF is a relation that is already in 1NF and in which non prime attribute is
functionally dependent on the proper subset of the candidate key of the
relation
A relation in 1NF can be converted into 2NF by removing the attributes that
are partially dependent on the prime attribute. These attributes are placed in
a new relation along with the prime attribute on which it is dependent
Another Example of 2NF
Student_Enrol
StuID CourseID CourseName Marks Credit
101 CSC01 C 80 3
101 BT01 Bioscience 60 2
102 CSC01 C 66 3
102 BT01 Bioscience 76 2
Course Student_Enrol
#Course
PK: CourseID
CourseID CorseName, Credit
# Student_Marks
CK: (StuID, CourseID)
StuID,CourseID Marks
Transitive Functional Dependency
The functional dependency X Z is transitive functional dependency in R when for a
set of attributes Y in R if X Y and Y Z hold where Y is not subset of any key of R
Example : Student (Sid, Sname, Address, Deptno, Hod)
PK: Sid
Sid Sname
Sid Address
Sid Deptno
Deptno Hod
Sid Hod is transitive dependency
So, Hod for a particular department appears multiple time, causing redundency
Relation which is in 2 NF has still redundancy and transitive dependency
Third Normal Form
A relation R is in 3NF if and only if
The relation R is already in 2 NF
No non prime attribute of R is transitively dependent on any key of R
Employee City_Info
Keys = A, BC
No prime attributes : D, E
So A D
D E
Hence, A E is transitive dependency. So R is not in 3 NF. It is in 2 NF
Examples
• Let relation R( A, B, C, D, E)
FDs: B A, A C, BC D, AC BE
Find the normal form.
Candidate keys: A, B
BC and AC are super keys
B A does not violate 2 NF rule, similarly other three FDs.
So , R is in 2 NF
L.H.S of all FDs are super keys. So R in 3 NF
Another Example of 3 NF
Let R (A,B,C,D) be a relation with following FDS. Check whether R is in 3NF or
not?
(i) AB C
(ii) AB D
(iii) C A
(iv) D B
Solution: Here, AB is one of the candidate key as AB can determine AB itself and
also C and D. So, AB determines all attributes of R.
But, C determines C and A. D determines D and B. From (i) and (ii) , we say AB is CK
Other CKs are AD, BC, CD
R is in 2 NF as C and D are not dependent on either A or B.
From (iii) C A , A is contained in a candidate key AB. Similarly, from (iv) D B. So, R is
in 3 NF
Advantages of 3 NF