Lecture - 15&16 - Functional Dependency
Lecture - 15&16 - Functional Dependency
Normalization and
Functional dependency
Normalization
2
Purpose of Normalization
3
Purpose of Normalization
❑ The benefits of using a database that has a
suitable set of relations is that the database will
be:
❑ Easier for the user to access and maintain the
data;
❑ Take up minimal storage space on the computer.
4
Data Redundancy and Update
Anomalies
5
Data Redundancy and Update
Anomalies
6
7
Data Redundancy and Update
Anomalies
8
Data Redundancy and Update
Anomalies
❑ Staff Branch relation has redundant data; the
details of a branch are repeated for every member
of staff.
9
Data Redundancy and Update
Anomalies
❑ Relations that contain redundant information may
potentially suffer from update anomalies.
10
Normalization
1 sara 20
2 ali 30
1 Sara 20
12
Normalization –column level duplicacy
13
Problems
F1 maryam 30000
F2 Ahad 20000
F3 Bushra 50000
F4 Saira 60000
16
Functional Dependencies
◼ Important concept associated with normalization.
17
Functional dependency
An Example Functional
Dependency
19
Functional dependency
20
21
22
FD-Example
23
Types of FD
24
Fully FD
25
Is fully dependent /not ??
26
Partial FD
27
FFD example :
◼ Student relation :
Name
Roll no
Grades
Games Fees
28
FFD /PFD
◼ Y is functionally ◼ Y is functionally
dependent on x and dependent on x and
29
Functional Dependencies
Trivial Functional dependency
31
Trivial and Non -trivial FD
◼ A B&B A ◼ A B&B A
❑ A A ❑ A C
❑ B B ❑ AB D
◼ AB B
❑ A A
❑ B B
32
Non-trivial FD
33
Transitive and non- Transitive
FDS
◼ Transitive : X Y and Y Z then X Z
❑ Ssid sname and sname city
sid city
Roll no Semester Name
Semester Hostel
X
Roll no Hostel (TFD) Roll no
Roll no Name (NTF) Semester
Y
Roll no Semester(NTF)
Hostel
Z
◼ It is due to the dependency between non -PK in relation
.
34
Properties of FD
◼ Reflexive X Y XՈY≠ᵠ
◼ Augmentation: if X Y , then XZ YZ
Ssid Sname
Ssid ,phone no Sname ,Phone no
35
Properties of FD
36
Closure method (Example 1 )
◼ R(A,B,C,D)
❑ FD{A B,B C ,C D,D A}
◼ A+ =ABCD
◼ B+ =BCDA
◼ C+= CDAB
◼ D+= DABC
CK ={A,B ,C ,D }
PA =(A,B ,C ,D )
NON PA = ᶲ
38
Closure method (Example 3 )
◼ R(A,B,C,D,E)
❑ FD{A B , BC D ,E C,D A}
❑ AE+ = AEBCD
❑ DE+ =BEABC
❑ BE+ =BECDA
❑ CE+ =CE CK= { AE,BE,DE}
PA = { A,B,D,E}
NPA =C
39
Example - Using sample data to
identify functional dependencies.
and ck . Also find PA and NPA
40
Example - Using sample data to
identify functional dependencies.
41
Example - Using sample data to
identify functional dependencies.
◼ Function dependencies between
attributes A to E in the Sample relation.
A→C (fd1)
C→A (fd2)
B →D (fd3)
A, B → E (fd4)
42
Normalization ---Decomposition
43
44