Lecture22 FD Normalization
Lecture22 FD Normalization
Systems
Functional Dependency
91.2814 3
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Functional Dependencies
EmpNum EmpEmail EmpFname EmpLname
123 [email protected] John Doe
456 [email protected] Peter Smith
555 [email protected] Alan Lee
633 [email protected] Peter Doe
787 [email protected] Alan Lee
91.2814 4
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Database Tables and Normalization
Dependency Diagram
The primary key components are bold,
underlined, and shaded in a different color.
The arrows above entities indicate all desirable
dependencies, i.e., dependencies that are based
on PK.
FigureMd.
5.3Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Functional Dependencies
EmpNum EmpEmail
EmpNum EmpFname 3 different ways
EmpNum EmpLname you might see FDs
depicted
EmpEmail
EmpNum EmpFname
EmpLname
91.2814 6
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Determinant
Functional Dependency
EmpNum EmpEmail
91.2814 7
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Transitive dependency
Transitive dependency
91.2814 8
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Transitive dependency
91.2814 9
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Transitive dependency
EmpNum DeptNum
DeptNum DeptName
91.2814 10
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Transitive dependency
91.2814 11
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Partial dependency
A partial dependency exists when an attribute B is
functionally dependent on an attribute A, and A is a
component of a multipart candidate key.
12
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
Normal Forms
Normalization is a process of organizing data to minimize data redundancy.
Each normal form is a set of conditions on a schema that guarantees certain properties that are
related to redundancy and update anomalies.
The normal forms based on FDs alone form a hierarchy with increasingly strict limitations on
the allowed functional dependencies as follows:
For a library
For an airline
Flight Weekdays
UA59 Mo We Fr
UA73 Mo Tu We Th Fr
91.2814 20
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
First Normal Form
To obtain 1NF relations we must, without loss of information,
replace the above with two relations
EmployeeDegree
Employee
EmpNum EmpDegree
EmpNum EmpPhone
333 BA
123 233-9876
333 BSc
333 233-1231
333 PhD
679 233-1231
679 BSc
679 MSc
91.2814 21
Md. Manowarul Islam, Dept. of CSE, Jagannath University, Dhaka-1100
First Normal Form (1NF)
A table is considered to be in 1NF if all the fields contain
only scalar values (as opposed to list of values).
Example (Not 1NF)
Table BorrowedBooks
Patron Address
J. Fisher 101 Main Street
L. Perez 202 Market Street
Contractor Contractor
Example 3 (Convert to 3NF) BuildingI Fee
D
100 Randolph Randolph 1200
Old Scheme {BuildingID, Contractor, Fee}
150 Ingersoll Ingersoll 1100
New Scheme {BuildingID, Contractor} 200 Randolph Pitkin 1100
New Scheme {Contractor, Fee} 250 Pitkin
300 Randolph