Professional Documents
Culture Documents
Norm Material1
Norm Material1
F7S / MIT
Nasrullah Memon
Objectives of Normalization
• Develop a good description of the data, its
relationships and constraints
• Produce a stable set of relations that
• Is a faithful model of the enterprise
• Is highly flexible
• Reduces redundancy-saves space and reduces
inconsistency in data
• Is free of update, insertion and deletion
anomalies
1
The Purpose of Normalization
Anomalies
• An anomaly is an inconsistent, incomplete,
or contradictory state of the database
• Insertion anomaly – user is unable to insert a new
record when it should be possible to do so
• Deletion anomaly – when a record is deleted,
other information that is tied to it is also deleted
• Update anomaly –a record is updated, but other
appearances of the same items are not updated
2
Redundancy
3
Decomposition
Solution: Use two relations to store Person information
Person(SSN, NAme, Address)
Hobbies(SSN, Hobby)
The decomposition is more general: people with hobbies now can be
described.
No update anomalies: Name and address stored once
A hobby can be separately supplied or deleted
Decomposition is the process of breaking a relation into two or more
relations to eliminate the redundancies and corresponding anomalies
Functional Dependencies
B is functionally
A B
dependent on A
4
Functional Dependencies (2)
Trival functional dependency means that the right-hand
side is a subset ( not necessarily a proper subset) of the left-
hand side.
For example:
staffNo, sName Æ sName
staffNo, sName Æ staffNo
• are nontrivial.
10
5
Functional Dependencies (4)
11
6
Functional Dependencies (6)
staffNo Æ sName
staffNo Æ position
staffNo Æ salary
staffNo Æ branchNo
staffNo Æ bAddress
branchNo Æ bAddress
branchNo, position Æ salary
bAddress, position Æ salary
14
7
The Process of Normalization
15
8
Data Normalization
UNORMALISED ENTITY
Example
ORDER NUMBER 1023
9
First Normal Form
• An entity type is in 1NF if there are no repeating
groups of attribute types
• Any un-normalised entity type is transformed to
1NF
– Remove all repeating attribute groups
– Repeating attribute groups become new entity
types in their own right
– The identifier of the original entity type must
be an attribute (but not necessarily an
identifier) of the derived entity type.
19
10
Example in 1NF
ORDER NUMBER 1023
SUPPLIER NUMBER 500028
21
Example
REGISTRATION FORM
22
11
Benefits from 1ST Normal Form
• Any 'hidden' entities are identified
• Process results in separation of different objects
• BUT anomalies may still exist
PURCHASE-ITEM-1( ORDER#, PART#, PART-
DESCRIPTION,QUANTITY-ORDERED, PRICE)
– PART-DESCRIPTION appears on every
PURCHASE-ITEM occurence.
– This may result in anomalies when updating or
deleting records
– The problem in the example is that PART-
DESCRIPTION is functionally dependent only on
PART# (part of the identifier)
23
12
Example
ORDER NUMBER 1023
SUPPLIER NUMBER 500028
25
Functional Dependencies
PURCHASE-ORDER (ORDER#, SUPPLIER#, ORDER-DATE
DELIVERY-DATE, TOTAL-PRICE)
PURCHASE-ITEM-1 ( ORDER#, PART#, PART-DESCRIPTION,
QUANTITY-ORDERED, PRICE)
PRICE
ORDER#
QUANTITY-
ORDERED
PART#
PART-
DESCRIPTION
26
13
In 2nd Normal Form
27
Example in 2NF
REGISTRATION FORM
14
Third normal Form
29
Example
REGISTRATION FORM
15
Functional Dependencies
Tutor-staff#
Student#
Course#
Tutor-name
31
Example in 3NF
REGISTRATION FORM
16
Boyce-Codd Normal Form (BCNF)
33
CLIENT_INTERVIEW BCNF
Interview Interview
Client_no Date Time Staff_no Room_no
17
BCNF
The relation CLIENT_INTERVIEW is in 3NF but not BCNF
To transform to BCNF:
Remove the violating FD and create two relations:
35
36
18
Multivalued Dependencies - 1
AUTHOR_NO BOOK_NO SUBJECT BOOK_TITLE AUTHOR_NAME
37
Multivalued Dependencies - 2
• Example models that "each AUTHOR is associated
with all the SUBJECTS under which the BOOK is
classified"
• The attribute SUBJECT contains redundant values. If
SUBJECT were deleted from rows 1 & 2 the values
could be deduced from rows 3 & 4
Anomaly because the same set
AUTHOR_NO BOOK_NO SUBJECT of SUBJECT is associated with
A1 B1 Comp. Sc. each AUTHOR of the same
BOOK
A1 B1 Maths
multidetermines
A2 B1 Comp. Sc.
BOOK_NO AUTHOR_NO
A2 B1 Maths
38
19
Fourth Normal Form
AUTHOR_NO BOOK_NO SUBJECT
IN 4th NORMAL FORM
A1 B1 Comp. Sc.
AUTHOR (Author_no,
A1 B1 Maths Author_name)
A2 B1 Comp. Sc. BOOK (Book_no, Book_Title)
A2 B1 Maths AUTHOR-BOOK (Author_no,
A3 B2 Maths Book_no)
BOOK-SUBJECT (Book_no,
Subject)
A1 B1 B1 Comp. Sc.
A2 B1 B1 Maths
A3 B2 B2 Maths
39
Conclusions
• Data Normalization is a bottom-up technique
that ensures the basic properties of the
relational model
– no duplicate tuples
– no nested relations
• Data normalisation is often used as the only
technique for database design - implementation
view
• A more appropriate approach is to complement
conceptual modelling with data normalization
40
20