Normalization New 1
Normalization New 1
Normalization New 1
Functional Dependencies
Data base anomalies
• Anomalies are problems that can occur in poorly planned, un-
normalised databases where all the data is stored in one table (a flat-
file database).
• Types:
• 1. Update
• 2. Insert
• 3 Delete anomalies
Types
• Insertion Anomaly - The nature of a database may be such that it is not
possible to add a required piece of data unless another piece of
unavailable data is also added. E.g. A library database that cannot store
the details of a new member until that member has taken out a book.
E5 P10 E Billing 10
Part_name Cost
Hard disk 1500
Pen drive 700
Hard disk 1500
CD 10
Pen drive 700
Full functional dependency
• An attribute is FFD on a set of attributes if
• It is functionally dependent on S and
• Not functionally dependent on any proper subset of S.
Roll_n NAme Course_id course_title Grade
um
1 Raj CSE306 NW C
2 Ankur CSE306 NW A
1 CSE Mr X
2 IT Mr Y
3 ECE Mr Z
4 ME Mr A
A B C
Multi-valued functional dependency
Name Ph_number
Ram 987217701
Sham 982271661
Ram 876622134
Rajesh 872213477
Raj 657932721
Ajay 873539262
A B
Name Ph_number
Decomposition of tables
• Lossy decomposition
• Lossless decomposition
Consider following table
A → B, A → C, A → D, A → E
A → E, B → E, C → E, D → E
However, we cannot generally summarize the above with ABCD → E because, in general, A → E, B → E, AB → E.
Dependency Diagram
A dependency diagram, shown in Figure 11.6, illustrates the various dependencies that might exist in a non-
normalized table. A non-normalized table is one that has data redundancy in it.
This table has a composite primary key [Customer ID, Store ID].
The non-key attribute is [Purchase Location]. In this case,
[Purchase Location] only depends on [Store ID], which is only
part of the primary key. Therefore, this table does not satisfy
second normal form.
A. This table is susceptible to update anomalies. Provide examples of insertion, deletion and update
anomalies.
B. Normalize this table to third normal form. State any assumptions.
4th Normal Form
• It is in BCNF
• There is no multi value dependency in relation
Emp-id Language skill
101 English Teaching
101 Hindi Conversation
101 English Conversation
101 hindi Teaching
202 English Singing
202 Hindi Teaching
Emp-id language
Emp-id skill
Anomalies
Delete—if id 101 discontinues teaching skill … then two rows to be delete
Update– if id 101 change its skill teaching to singing … then number of changes to
be done.
This table could be divided in following two tables:
Emp-id Language
101 English
101 Hindi
202 English
202 hindi
Emp-id skills
101 Teaching
101 Conversation
202 Singing
202 Teaching
5th Normal Form
• A relation R is in Fifth Normal Form (5NF) if and only if the following conditions
are satisfied simultaneously:
• 1. R is already in 4NF.
• 2. It cannot be further non-loss decomposed.
Consider Following data base:
transitive
dependencies
E.F. Codd’s 12 Rules for RDBMS
According to him, a DBMS is fully relational if it abides by all his twelve rules.
Till now, only few databases abide by all the eleven rules.
To solve this, we normalize tables. We have broken the above table into 2 tables,
repeating columns we have moved into a separate table