Академический Документы
Профессиональный Документы
Культура Документы
Normalization
• Describe the process, strengths and weaknesses of Data Normalisation, and
so demonstrate an understanding of when and to what extent the technique
should be applied in practice
Learning Outcome
• Explain and apply the concepts of Functional Dependency and Determinant
through the understanding and construction of Determinacy Diagrams
• Lossy designs
Redundant Data
Anomalies - Modification
Deleting student 21 will result in deleting and losing data as well about dept
2.
Anomalies - Insertion
called
Lossy Decomposition
Decomposed into:
BUT
We have LOST the information of the relationship between
student and the department in which the student is enrolled
• Top-down database design:
Requirements
Mini-world
E1
R
? Relation schemas
Conceptual schema
E2
Functional Dependencies
• Dependencies between different
ATTRIBUTES - determinant
• Direct dependency
• Indirect dependency (Transitive)
• Partial dependency
Determinant
– X is a determinant of Y if each value of X has precisely
one (possibly NULL) associated value of Y
– Another way: X is a determinant of Y if and only if
whenever two tuples agree on their X value they agree
on their Y value
– X determines Y or Y is functionally dependent on X
– Formal definition:
• A functional dependency, denoted by X -> Y,
between two sets of attributes X and Y that are
subsets of R specifies a constraint on the possible
tuples that can form a relation state r of R. The
constraint is that, for any two tuples t1 and t2 in r that
have t1[X] = t2[X], we must also have t1[Y] = t2[Y]
– Functional determinancy diagram shows the
dependencies in a visual format X Y
Determinacy Diagram – Direct Dependency
Performer-id Performer-name
Performer-type
Performer-
location
Performer-id Performer-name
Performer-type Fee
Performer-
location
Performer-location
Booking
Date
Agent-id Agent-name
Agent-location
PerID Per Per Per Fee AgID Ag AgLoc EvID EvName EvType BDate
Name Loc Type Name
100 Baron Mu S 75 A10 Blue PL E01 Gold Mus Jan10
A09 Black Cpe E02 Silver Drama Feb10
A05 Green Qb E03 Diamond Opera Mar10
101 Steed Fr D 100 A11 Red Pr E04 Copper Show Apr10
A12 White Bd E05 Bronze Ballet Feb10
102 Jones Ind A 50 A06 Blk By E06 Jupiter Drama Mar10
103 Eagle Uk C 60 A07 Pink Lon E07 Ruby Ballet May10
A08 Yello Liv E08 Plati Concer Apr10
104 Stoke Hk S 75 A01 Wht Zy E09 Gem Mus Feb10
105 Brass Aus C 60 A02 Brw Sy E10 Choc Show Jun10
A03 Purpl Mel E11 Coffee Mus Apr10
106 Peter Gm D 100 A04 Grey Ams E12 Crystal Opera Aug10
Determinancy Diagram – Performer-name
Performer-id Performer-location
Performer-type Fee
Agent-name
Agent-id
1NF
Agent-location
Event-id Event-name
Event-type
Booking-date
PerID Per Per Per Fee AgID Ag AgLoc EvID EvName EvType BDate
Name Loc Type Name
Normalized Form (1NF)
PerID Per Per Per Fee AgID Ag AgLoc EvID EvName EvType BDate
Name Loc Type Name
100 Baron Mu S 75 A10 Blue PL E01 Gold Mus Jan10
100 Baron Mu S 75 A09 Black Cpe E02 Silver Drama Feb10
100 Baron Mu S 75 A05 Green Qb E03 Diamond Opera Mar10
101 Steed Fr D 100 A11 Red Pr E04 Copper Show Apr10
101 Steed Fr D 100 A12 White Bd E05 Bronze Ballet Feb10
102 Jones Ind A 50 A06 Blk By E06 Jupiter Drama Mar10
103 Eagle Uk C 60 A07 Pink Lon E07 Ruby Ballet May10
103 Eagle Uk C 60 A08 Yello Liv E08 Plati Concer Apr10
104 Stoke Hk S 80 A01 Wht Zy E09 Gem Mus Feb10
105 Brass Aus C 95 A02 Brw Sy E10 Choc Show Jun10
105 Brass Aus C 95 A03 Purpl Mel E11 Coffee Mus Apr10
106 Peter Gm D 75 A04 Grey Ams E12 Crystal Opera Aug10
Redundant
Data Each cell
No
containing one
Primary
value
Key
• First normal form (1NF) - there is only one
value at the intersection of each row and
column of a relation - no set valued attributes
in 1 NF
• To be part of the formal definition of a relation
in the basic (flat) relational model
• Problem with 1NF - no primary key for the
relation
2NF determinancy diagram Relation in 2NF
PerID Per Per Per Fee
Performer- Name Loc Type
Performer-id
name 100 Baron Mu S 75
Performer- Fee 101 Steed Fr D 100
type
102 Jones Ind A 50
Performer- 103 Eagle Uk C 60
location
104 Stoke Hk S 80
105 Brass Aus C 95
106 Peter Gm D 75
AgID Ag AgLoc
Agent-name Name
Agent-id
A10 Blue PL
Agent-location A09 Black Cpe
A05 Green Qb
A11 Red Pr
A12 White Bd
A06 Blk By
A07 Pink Lon
A08 Yello Liv
A01 Wht Zy
A02 Brw Sy
A03 Purpl Mel
104 Stoke Hk S
106 Peter Gm D
Performer- Fee A 50
type
C 60
Transitive Dependency D 100
identified and treated as a S 75
separate relation.
• Third normal form (3NF) - all attributes must
be directly dependent on primary key
• 3NF solves indirect (transitive) dependencies
problem in 1NF and 2NF
• Method: identify all transitive dependencies
and each transitive dependency will form a
new relation, with non-prime attributes
participating in the transitive dependency and
the attribute which determines others as the
attributes for the new relation
Relational Database Schema Produced
TypeFee(PerType, Fee)
Agent(AgID, AgName)
AgLocation(AgID, AgLoc)