Professional Documents
Culture Documents
Lecture 4
Database Design Theory
Korra Sathya Babu
Department of Computer Science
NIT Rourkela
1
Unit Overview
Functional Dependency
Decomposition
Normalization
Modeling
year
title
Movies
name
Stars-In
address
Stars
name
length
filmType
Owns
Studios
address
Redundancy
Insertion Anomaly
Updation Anomaly
Deletion Anomaly
Functional Dependency
Definition
Trivial Dependency
Trivial Dependency
Armstrong Axioms
Reflexivity
Transitivity
Y, then X Y)
Augumentation
(If X
Sound
They generate only FDs in F+ when applied to a set of FDs
Complete
They when repeatedly applied, these rules will generate all
FDs in F+
9
xx xy ; xy yz
x xy ; xy yz
xy, xy
yz]
10
Y and YW Z, then XW Z)
xw yw
yw, yw
z]
xx yx
We already have xz, So replace x with z in determinee
xx yx
xyz
11
12
Redundant FDs
14
Redundant FDs
Step 1: Remove temporarily AB from F and initialize the set of FDs G to F. ie. Set
G=F-{AB}. If G proceed to step 2; otherwise stop executing the algorithm
since AB is non redundant
Step 2: Initialize the set of attributes Ti (with i=1) with the set of attribute(s) A(the
determinant of the FD under consideration). ie. Set Ti = T1 = {A}. The set T1 is the
current Ti
Step 3: In the set G search for FDs XY such that all the attributes of the
determinant X are elements of the current set Ti. There are two possible outcomes
Step 3a: If such FD is found, add the attribute of Y (right hand side of FD) to set Ti
and form a new Set Ti + 1= Ti U Y. The Set Ti + 1 is the current Ti .
Check if all the attributes of B (the right hand side of FD under consideration) are
members of Ti + 1. If this is the case, stop executing algorithm becos the FD:AB is
redundant. If not all attributes of B are members of Ti + 1 , remove XY from G
and repeat step 3
Step 3a: If G= or there are no FDs in G that have all the attributes of its
determinant in the current Ti then AB is not redundant
15
Redundant FDs
16
Closure of FD Set
Definition
The set of all FDs implied by a given set F of FDs is called the closure of F,
and denoted as F+
Armstrong Axioms can be applied repeatedly to infer all FDs implied by a
set F of FDs
A F={ABC}
+
B F={B}
+
AB F={ABC}
+
AC F={ABC}
+
ABC F=
F = {X X, Y Y, Z Z,
XY X, XY Y, XY XY, XY Z
XZ X, XZ Z, XZ XZ,
YZ Y, YZ Z, YZ YY,
XYZ X, XYZ Y, XYZ Z,
XYZ XY, XYZ XZ, XYZ YZ,
XYZ XYZ,}
Attribute Closure
18
Candidate Key
19
Candidate Key
20
22
Problem
Find the non-redundant cover G for the set
F={X YZ, ZW P, P Z, W XPQ, XYQ YW, WQ YZ}
23
Extraneous Attribute
When the algorithm finishes the set G contains a left-reduced cover set of T
25
Extraneous Attribute
Tip :
26
Canonical Cover
27
Minimal Cover
Optimal Cover
29
Problems
30
Seminar change?
31
Summary
32