The document discusses functional dependency and normalization. It defines functional dependency and outlines Armstrong's axioms for functional dependencies. It also defines normalization objectives and normal forms including 1NF, 2NF and 3NF. The document provides examples of functional dependencies and canonical covers. It discusses anomalies that can occur in 1NF relations including insertion, deletion and update anomalies. Finally, it defines partial and transitive dependencies.
You can get clear knowledge about the functional dependencies in "Normalization". And also the rules, types of FDs and finally the closure and its applications
You can get clear knowledge about the functional dependencies in "Normalization". And also the rules, types of FDs and finally the closure and its applications
Database normalization is the process of structuring a relational database in accordance with a series of so-called normal forms in order to reduce data redundancy and improve data integrity. It was first proposed by Edgar F. Codd as part of his relational model.
Agenda
What Is Normalization?
Why We Use Normalization?
Various Levels Of Normalization
Any Tools For Generate Normalization?
By Harsiddhi Thakkar
If you have any query
Contact me on : harsiddhithakkar94@gmail.com
The normal forms (NF) of relational database theory provide criteria for determining a table’s degree of vulnerability to logical inconsistencies and anomalies.
Functional dependencies in Database Management SystemKevin Jadiya
Slides attached here describes mainly Functional dependencies in database management system, how to find closure set of functional dependencies and in last how decomposition is done in any database tables
Lecture notes on Functional dependencies, normal forms, first, second, third normal forms, BCNF, inclusion dependence, loss less join decompositions, normalization using FD, MVD, and JDs, alternative approaches to database design.
Database normalization is the process of structuring a relational database in accordance with a series of so-called normal forms in order to reduce data redundancy and improve data integrity. It was first proposed by Edgar F. Codd as part of his relational model.
Agenda
What Is Normalization?
Why We Use Normalization?
Various Levels Of Normalization
Any Tools For Generate Normalization?
By Harsiddhi Thakkar
If you have any query
Contact me on : harsiddhithakkar94@gmail.com
The normal forms (NF) of relational database theory provide criteria for determining a table’s degree of vulnerability to logical inconsistencies and anomalies.
Functional dependencies in Database Management SystemKevin Jadiya
Slides attached here describes mainly Functional dependencies in database management system, how to find closure set of functional dependencies and in last how decomposition is done in any database tables
Lecture notes on Functional dependencies, normal forms, first, second, third normal forms, BCNF, inclusion dependence, loss less join decompositions, normalization using FD, MVD, and JDs, alternative approaches to database design.
It is very helpful in learning all the basics concepts of DBMS starting from Introduction: An Overview of Database Management System to Data Modeling using the Entity-Relationship Model, PL/SQL, Transaction Processing Concept, and Concurrency Control Techniques plus important numerals in exam point of view can be learned.
In this chapter, we talk about basic concepts of relational database design. We talk about the concept of functional dependency, Armstrong's axioms, closures, and minimal cover.
Normalization is the process of organizing data in a database. This includes creating tables and establishing relationships between those tables according to rules designed both to protect the data and to make the database more flexible by eliminating redundancy and inconsistent dependency.
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NFijdms
When an attempt is made to modify tables that have not been sufficiently normalized undesirable sideeffects
may follow. This can be further specified as an update, insertion or deletion anomaly depending on
whether the action that causes the error is a row update, insertion or deletion respectively. If a relation R
has more than one key, each key is referred to as a candidate key of R. Most of the practical recent works
on database normalization use a restricted definition of normal forms where only the primary key (an
arbitrary chosen key) is taken into account and ignoring the rest of candidate keys.
In this paper, we propose an algorithmic approach for database normalization up to third normal form by
taking into account all candidate keys, including the primary key. The effectiveness of the proposed
approach is evaluated on many real world examples
MLDM provides an original scientific position in Europe on problems related to pattern recognition, machine learning, classification, modelling, knowledge extraction and data mining. These issues have a strong employability potential for students trained in the field of modelling, prediction or decision support, as well as in the area of the Web, image and video processing, health informatics, etc.
For graphs of mathematical functions, see Graph of a function. For other uses, see Graph (disambiguation). A drawing of a graph. In mathematics graph theory is the study of graphs, which are mathematical structures used.In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any acyclic connected graph is a tree. A forest is a disjoint union of trees.
Synchronous Optical Networking (SONET) and Synchronous Digital Hierarchy (SDH) are standardized multiplexing protocols that transfer multiple digital bit streams over optical fiber using lasers or light-emitting diodes (LEDs). Lower data rates can also be transferred via an electrical interface.
Discrete Mathematics - Sets. ... He had defined a set as a collection of definite and distinguishable objects selected by the means of certain rules or description. Set theory forms the basis of several other fields of study like counting theory, relations, graph theory and finite state machines.
Discrete Mathematics - Sets. ... He had defined a set as a collection of definite and distinguishable objects selected by the means of certain rules or description. Set theory forms the basis of several other fields of study like counting theory, relations, graph theory and finite state machines.
The Parallel RLC Circuit is the exact opposite to the series circuit we looked at in the previous tutorial although some of the previous concepts and equations still apply.
The Parallel RLC Circuit is the exact opposite to the series circuit we looked at in the previous tutorial although some of the previous concepts and equations still apply.
Discrete Mathematics - Relations. ... Relations may exist between objects of the same set or between objects of two or more sets. Definition and Properties. A binary relation R from set x to y (written as x R y o r R ( x , y ) ) is a subset of the Cartesian product x × y .
Propositional calculus (also called propositional logic, sentential calculus, sentential logic, or sometimes zeroth-order logic) is the branch of logic concerned with the study of propositions (whether they are true or false) that are formed by other propositions with the use of logical connectives, and how their value depends on the truth value of their components. Logical connectives are found in natural languages.
Propositional calculus (also called propositional logic, sentential calculus, sentential logic, or sometimes zeroth-order logic) is the branch of logic concerned with the study of propositions (whether they are true or false) that are formed by other propositions with the use of logical connectives, and how their value depends on the truth value of their components. Logical connectives are found in natural languages.
In computer science, Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized.
Discrete Mathematics is a branch of mathematics involving discrete elements that uses algebra and arithmetic. It is increasingly being applied in the practical fields of mathematics and computer science. It is a very good tool for improving reasoning and problem-solving capabilities.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
2. 7/24/2017 2Md. Golam Moazzam, Dept. of CSE, JU
OUTLINE
Functional Dependency (FD)
Inference Axioms for FDs
Trivial and Non-trivial Dependency
Canonical Cover
Normalization Process: Objectives
1NF, 2NF, 3NF
Data Anomalies
Partial Dependencies
Transitive Dependencies
Boyce-Codd Normal Form
Decomposition: Lossless or Lossy
3. Functional Dependency
Objectives
- To control the redundancy of data.
- To preserve the consistency of data.
Data redundancy occurs when a piece of data is stored in more
than one place in the database.
If the content of that piece of data is changed to a particular
value, then it is necessary to ensure that every copy of the same
piece of data is changed to the same value. This piece of data is
said to be consistent in the database.
If some, but not all, copies of this piece of data are changed to
the same value, the data is said to be inconsistent.
7/24/2017 3Md. Golam Moazzam, Dept. of CSE, JU
4. Functional Dependency
Functional Dependency (FD)
– Given a relation r(R) and two sets of its attributes A and B.
We will say that attribute(s) A functionally determines
attribute(s) B with respect to r, denoted by A → B, if and
only if for any two tuples t1 and t2 of r whenever
t1(A) = t2(A) then t1(B) =t2(B).
– That is, if A functionally determines B, then whenever two
tuples of r have identical values in column A, their
respective values in column B must also be identical.
7/24/2017 4Md. Golam Moazzam, Dept. of CSE, JU
5. Functional Dependency
Functional Dependency (FD)
7/24/2017 5Md. Golam Moazzam, Dept. of CSE, JU
Name Continent Area Length
Caspian Sea Asia – Europe 143244 760
Superior North America 31700 350
Victoria Africa 26828 250
Aral Sea Asia 24904 280
Huron North America 23000 206
Michigan North America 22300 307
Tanganyika Africa 12700 420
Lakes-of-The-World
6. Functional Dependency
Functional Dependency (FD)
Example: Given the Lakes-Of-The-World relation shown
above, state whether or not the functional dependencies
(a) Continent → Name and
(b) Name → Length are satisfied by this relation.
7/24/2017 6Md. Golam Moazzam, Dept. of CSE, JU
7. Functional Dependency
Functional Dependency (FD)
(a) Here t1(Continent)= t2(Continent)=North America
But t1(Name)= Superior ≠ t2(Name)=Huron
So, Continent → Name is not satisfied by the relation
i.e. Continent Name.
(b) The functional dependency Name → Length is satisfied by
the relation. Because for any given lake, there is only one
length associated with it.
7/24/2017 7Md. Golam Moazzam, Dept. of CSE, JU
8. Functional Dependency
Inference Axioms for FDs/Armstrong's axioms
Given a set F of FDs, the inference axioms are a set of rules that tell
us that if a relation satisfies the FDs of F, the relation must satisfy
certain other FDs. The latter set of FDs are said to be derived or
logically deduced from the FDs of F.
1. If Y X, then X → Y (Reflexivity)
2. If X → Y, then XW → Y and/or XW → YW(Augmentation)
3. If X → Y and Y → Z, then X → Z (Transitivity)
4. If X → Y and YW → Z, then XW → Z (Pseudotransitivity)
5. If X → Z and X → Y, then X → YZ (Additivity or Union)
6. If X → YZ then X → Y and X → Z ( Projectivity or
Decomposition)
7/24/2017 8Md. Golam Moazzam, Dept. of CSE, JU
9. Functional Dependency
Trivial and Non-trivial Dependency
Trivial
– A functional dependency FD: X → Y is called trivial if Y is a
subset of X.
– In other words, a dependency FD: X → Y means that the values
of Y are determined by the values of X.
Non-Trivial
– If an FD X → Y holds, where Y is not a subset of X, then it is
called a non-trivial FD.
7/24/2017 9Md. Golam Moazzam, Dept. of CSE, JU
10. Functional Dependency
Canonical Cover
For a given set F of FDs, a canonical cover, denoted by Fc, is a
set of FDs where the following conditions are simultaneously
satisfied:
1. Every FD of Fc is simple. That is, the right-hand side of
every functional dependency of Fc has only one attribute.
2. Fc is left-reduced.
3. Fc is nonredundant.
7/24/2017 10Md. Golam Moazzam, Dept. of CSE, JU
11. Functional Dependency
Canonical Cover
Example: Given the set F of FDs shown below, find a canonical cover for F.
F= {X → Z, XY → WP, XY → ZWQ, XZ → R}.
FC = {X → Z, XY → WP, XY → ZWQ, XZ → R}
= {X → Z, XY → W, XY → P, XY → Z, XY → W, XY → Q, XZ → R}. [Simple]
= {X → Z, XY → W, XY → P, XY → Z, XY → Q, XZ → R}. [Remove redundancy]
= {X → Z, XY → W, XY → P, XY → Z, XY → Q, XZ → R}.
= {X → Z, XY → W, XY → P, XY → Q, XZ → R}. [Remove redundancy]
= {X → Z, XY → W, XY → P, XY → Q, XZ → R}.
= {X → Z, XY → W, XY → P, XY → Q, X → R}. [Left-reduced]
FC = {X → Z, XY → W, XY → P, XY → Q, X → R}.
This resulting set where all FDs are simple, left-reduced and
non-redundant, is the canonical cover of F.
7/24/2017 11Md. Golam Moazzam, Dept. of CSE, JU
12. Functional Dependency
Problem 1: Assume that AB → C, C → D and D → A are
simultaneously satisfied by a relation r(R). What are the
candidate keys of this relation? Which one is the PK? What are
the prime attributes? Are there any super keys for this relation?
Solution:
A set of attributes of r is a candidate key of r if and only if the
set functionally determines every attribute of the relation. The
set of attributes that can be selected as candidate keys of the
relation r are: AB and DB. Let's see why.
7/24/2017 12Md. Golam Moazzam, Dept. of CSE, JU
13. Functional Dependency
Problem 1: Assume that AB → C, C → D and D → A . . . . .
AB is a candidate key.
The given FDs are: AB → C, C → D and D → A.
If AB is a key of r then it must be true that
AB → A, AB → B, AB→ C and AB→ D.
Using the inference axioms and the FDs of F we have that:
AB → A and AB → B ( Reflexivity axiom)
AB → C (given)
AB → C (given) and C → D (given) then AB → D (Transitivity
axiom)
Therefore, AB is a candidate key of the relation r because it
functionally determines any other attribute of the relation r.
7/24/2017 13Md. Golam Moazzam, Dept. of CSE, JU
14. Functional Dependency
DB is another candidate key.
The given FDs are: AB → C, C → D and D → A.
If DB is a key of r then it must be true that
DB → A, DB → B, DB → C and DB → D.
Using the inference axioms and the FDs of we have that;
DB → D and DB → B (Reflexivity axiom)
DB → D (previous step) and D → A (given) we have that DB → A
(Transitivity axiom)
DB → A (from previous step) and AB → C (given) then DBB → C
(Pseudotransitivity axiom)
Since B U B= B we can rewrite DBB → C as DB → C.
Therefore, DB is a candidate key of the relation r because it
functionally determines all other attributes of the relation r.
7/24/2017 14Md. Golam Moazzam, Dept. of CSE, JU
15. Functional Dependency
– There are two candidate keys AB and DB. However, only
one can be selected as the PK of the relation. The database
designer or the DBA should choose the one that makes more
sense or is more convenient for the application.
– The prime attributes of this relation are: A, B and D. A prime
attribute is any attribute that is part of a PK or an alternate
key.
– There are several super keys. They are: ABC, ADB, ABCD,
DBA, DBC and DBAC.
7/24/2017 15Md. Golam Moazzam, Dept. of CSE, JU
16. Functional Dependency
Problem 2: Given the relation r(A, B, C) and the set F={AB → C, B →
D, D → B} of functional dependencies, find the candidate keys of the
relation. How many candidate keys are in this relation? What are the
prime attributes?
AB is a candidate key.
AB → A and AB → B ( Reflexivity axiom)
AB → C (given)
AB → B (step 1) and B → D (given) then AB → D ( Transitivity
axiom)
Since AB determines every other attribute of the relation, we have that
AB is a candidate key.
7/24/2017 16Md. Golam Moazzam, Dept. of CSE, JU
17. Functional Dependency
Problem 2:. . . . .
AD is a candidate key.
AD → A and AD → D ( Reflexivity axiom)
AD → D (step 1) and D → B (given) then AD → B
AD → B (step 2) and AB → C (given) then AAD → C
(Pseudotransitivity axiom).
i.e. AD → C
Since AD determines every other attribute of the relation, we have that
AD is another candidate key.
The prime attributes are: A, B, and D.
7/24/2017 17Md. Golam Moazzam, Dept. of CSE, JU
18. Functional Dependency
Prime and Non-prime attribute
– Prime attribute
• An attribute, which is a part of the primary-key, is known as a
prime attribute.
– Non-prime attribute
• An attribute, which is not a part of the primary-key, is said to
be a non-prime attribute.
7/24/2017 18Md. Golam Moazzam, Dept. of CSE, JU
19. Normalization
Normalization
– It refers to a reversible step-by-step process in which a
given set of relations is replaced by successive collections
of relations that have a progressively simpler and more
regular structure.
– Each step is referred to as a normal form.
– Since the process is reversible, the original set of relations
can be recovered with no loss of information.
7/24/2017 19Md. Golam Moazzam, Dept. of CSE, JU
20. Normalization
Objectives
– To make it feasible to represent any relation in the database.
– To obtain powerful relational retrieval algorithms based on a
collection of primitive relational operators.
– To free relations from undesirable insertion, update, and
deletion anomalies.
– To reduce the need for restructuring the relations as new data
types are introduced.
7/24/2017 20Md. Golam Moazzam, Dept. of CSE, JU
21. Normalization
Question: Normalize step by step the following database into 1NF, 2NF
and 3NF:
PROJECT(Proj-ID, Proj-Name, Proj-Mgr-ID, Emp-ID, Emp-Name,
Emp-Dpt, Emp-Hrly-rate, Total-Hrs)
Solution:
Table entries that have more than one value are called multivalue
entries. Table with multivalue entries are called unnormalized tables.
Within an unnormalized table, we will call a repeating group an
attribute or group of attributes that may have multivalue entries for
single occurrences of the table identifier. Here table PROJECT is an
unnormalized table where attributes Emp-ID, Emp-Name, Emp-Dpt,
Emp-Hrly-rate, and Total-Hrs are repeating groups. Thus, we need to
put the table in first normal form (1NF).
7/24/2017 21Md. Golam Moazzam, Dept. of CSE, JU
22. Normalization
PROJECT(Proj-ID, Proj-Name, Proj-Mgr-ID, Emp-ID, Emp-Name,
Emp-Dpt, Emp-Hrly-rate, Total-Hrs)
FIRST NORMAL FORM (1NF)
– A relation r(R) is said to be in First Normal Form (1NF), if and
only if every entry of the relation has at most a single value.
– Thus, it requires to decompose the table PROJECT into two new
tables.
– It is also necessary to identify a PK for each table.
7/24/2017 22Md. Golam Moazzam, Dept. of CSE, JU
23. Normalization
PROJECT(Proj-ID, Proj-Name, Proj-Mgr-ID, Emp-ID, Emp-Name,
Emp-Dpt, Emp-Hrly-rate, Total-Hrs)
– First table with nonrepeating groups:
PROJECT (Proj-ID, Proj-Name, Proj-Mgr-ID)
– Second table with table identifier and all repeating groups:
PROJECT-EMPLOYEE (Proj-ID, Emp-ID, Emp-Name,
Emp-Dpt, Emp-Hrly-rate, Total-Hrs)
– Here Proj-ID is the table identifier.
7/24/2017 23Md. Golam Moazzam, Dept. of CSE, JU
24. Normalization
Data Anomalies in 1NF Relations
– Redundancies in 1NF relations lead to a variety of data
anomalies:
• Insertion anomalies,
• Deletion anomalies and
• Update anomalies.
7/24/2017 24Md. Golam Moazzam, Dept. of CSE, JU
25. Normalization
Data Anomalies in 1NF Relations
– Insertion anomalies occur in PROJECT-EMPLOYEE relation
because we cannot insert information about any new employee
unless that employee is already assigned to a project. Any attribute
of the composite key (Proj-ID, Emp-ID) cannot be NULL.
– Deletion anomalies occur when we delete the last tuple of a
particular employee. In this case, we not only delete the project
information that connects that employee to a particular project but
also lose other information about the department for which this
employee works.
7/24/2017 25Md. Golam Moazzam, Dept. of CSE, JU
26. Normalization
Data Anomalies in 1NF Relations
– Update anomalies occur because the department for which an
employee works may appear many times in the table. It is this
redundancy of information that causes the anomaly because if
an employee moves to another department, we are now faced
with two problems: we either search the entire table looking
for that employee and update his Emp-Dpt value or we miss
one or more tuples of that employee and end up with an
inconsistent state.
7/24/2017 26Md. Golam Moazzam, Dept. of CSE, JU
27. Normalization
Partial Dependencies
– Given a relation r(R), the sets of attributes X and Y ( X,Y R),
and X → Y, we will say that attribute Y is fully dependent on
attribute X if only if there is no proper subset W of X such
that W → Y.
– If there is a proper subset W of X such that W → Y then
attribute Y is said to be partially dependent on attribute X.
7/24/2017 27Md. Golam Moazzam, Dept. of CSE, JU
29. Normalization
SECOND NORMAL FORM (2NF)
A relation r (R) is in Second Normal Form (2NF) if and only if the
following two conditions are met simultaneously:
• r(R) is already in 1NF.
• No nonprime attribute is partially dependent on any key or,
equivalently, each nonprime attribute in R is fully dependent
on every key.
7/24/2017 29Md. Golam Moazzam, Dept. of CSE, JU
30. Normalization
SECOND NORMAL FORM (2NF)
– In PROJECT-EMPLOYEE relation attributes Emp-Name,
Emp-Dpt and Emp-Hrly-rate are fully dependent only on Emp-
ID.
– The only attribute Total-Hrs fully depends on the composite PK
(Proj-ID, Emp-ID). This is shown below.
7/24/2017 30Md. Golam Moazzam, Dept. of CSE, JU
PROJECT-EMPLOYEE (Proj-ID, Emp-ID, Emp-Name, Emp-Dpt, Emp-Hrly-rate, Total-Hrs)
31. Normalization
SECOND NORMAL FORM (2NF)
Now break this relation into two new relations so that partial dependency
does not exist.
– HOURS-ASSIGNED (Proj-ID, Emp-ID, Total-Hrs)
– EMPLOYEE (Emp-ID, Emp-Name, Emp-Dpt, Emp-Hrly-rate)
7/24/2017 31Md. Golam Moazzam, Dept. of CSE, JU
32. Normalization
Data Anomalies in 2NF Relations
Relations in 2NF are still subject to data anomalies:
Insertion anomalies,
Deletion anomalies and
Update anomalies.
7/24/2017 32Md. Golam Moazzam, Dept. of CSE, JU
33. Normalization
Data Anomalies in 2NF Relations
Insertion anomalies:
– For sake of explanation, let us assume that the department in which
an employee works functionally determines the hourly rate charged
by that employee. That is,
Emp-Dpt → Emp-Hrly-rate.
– Insertion anomalies occur in the EMPLOYEE relation. For
example, consider a situation where we would like to set in
advance the rate to be charged by the employees for a new
department. We cannot insert this information until there is an
employee assigned to that department.
7/24/2017 33Md. Golam Moazzam, Dept. of CSE, JU
34. Normalization
Data Anomalies in 2NF Relations
Deletion anomalies occur whenever we delete the tuple of an
employee who happens to be the only employee left in a department.
In this case, we lose the information about the rate that the department
charges.
Update anomalies occur because there may be several employees
from the same department working on different projects. If the
department rate changes, we need to make sure that the corresponding
rate is changed for all employees that work for that department.
Otherwise, the database may end up in an inconsistent state.
7/24/2017 34Md. Golam Moazzam, Dept. of CSE, JU
35. Normalization
Transitive Dependencies
Assume that A, B, and C are the set of attributes of a relation r(R).
Further assume that the following functional dependencies are
satisfied simultaneously:
A → B,
B A,
B → C,
C A and A → C.
C → B is neither prohibited nor required.
If all these conditions are true, we will say that attribute C is
transitively dependent on attribute A.
7/24/2017 35Md. Golam Moazzam, Dept. of CSE, JU
36. Normalization
THIRD NORMAL FORM (3NF)
– A relation r(R) is in Third Normal Form (3NF) if and only if the
following conditions are satisfied simultaneously:
• r(R) is already in 2NF.
• No nonprime attribute is transitively dependent on the key (i.e.
No nonprime attribute functionally determines any other
nonprime attribute).
7/24/2017 36Md. Golam Moazzam, Dept. of CSE, JU
37. Normalization
THIRD NORMAL FORM (3NF)
In EMPLOYEE relation, attribute Emp-Hrly-rate is transitively
dependent on the PK Emp-ID through the functional dependency
Emp-Dpt → Emp-Hrly-rate. This is shown below.
7/24/2017 37Md. Golam Moazzam, Dept. of CSE, JU
EMPLOYEE (Emp-ID, Emp-Name, Emp-Dpt, Emp-Hrly-rate)
38. Normalization
THIRD NORMAL FORM (3NF)
7/24/2017 38Md. Golam Moazzam, Dept. of CSE, JU
EMPLOYEE (Emp-ID, Emp-Name, Emp-Dpt, Emp-Hrly-rate)
Now break this relation into two new relations so that transitive dependency does
not exist.
EMPLOYEE (Emp-ID, Emp-Name, Emp-Dpt)
CHARGES (Emp-Dpt, Emp-Hrly-rate)
The new set of relations that we have obtained through the normalization process
does not exhibit any of the anomalies. That is, we can insert, delete and update
tuples without any of the side effects.
39. Normalization
Data Anomalies in 3NF Relations
Relations in 3NF are still susceptible to data anomalies
particularly when the relations have two overlapping candidate
keys or when a non prime attribute functionally determines a
prime attribute.
7/24/2017 39Md. Golam Moazzam, Dept. of CSE, JU
40. Normalization
Question. Normalize the following database step by step into 1NF,
2NF and 3NF:
SALES (Emp-No, Emp-Name, Store-Branch, Department, Item-No,
Item-Description, Sale-Price)
Solution:
Test Condition 1: Is the database unnormalized?
That is, repeating group and non-repeating group exist
simultaneously?
Then i) Decompose the table into two new tables.
ii) Identify PK for each table.
ii) Set a table identifier.
7/24/2017 40Md. Golam Moazzam, Dept. of CSE, JU
41. Normalization
SALES (Emp-No, Emp-Name, Store-Branch, Department, Item-No, Item-
Description, Sale-Price)
FIRST NORMAL FORM (1NF)
Non-Repeating group: Emp-No, Emp-Name, Store-Branch, Department
Repeating group: Item-No, Item-Description, Sale-Price
First table with non-repeating groups:
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
Second table with table identifier and all repeating groups:
SALES (Emp-No, Item-No, Item-Description, Sale-Price)
Here Emp-No is the table identifier.
7/24/2017 41Md. Golam Moazzam, Dept. of CSE, JU
42. Normalization
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
SALES (Emp-No, Item-No, Item-Description, Sale-Price)
SECOND NORMAL FORM (2NF)
Test Condition 2: Data anomalies occur? Partial dependency exists?
Then i) Decompose the table into two new tables.
ii) Identify PK for each table.
In SALES relation, attribute Sale-Price is fully dependent on the
composite PK (Emp-No, Item-No). The attribute Item-Description
depends only on Item-No. This is shown below.
7/24/2017 42Md. Golam Moazzam, Dept. of CSE, JU
SALES (Emp-No, Item-No, Item-Description, Sale-Price)
43. Normalization
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
SALES (Emp-No, Item-No, Item-Description, Sale-Price)
SECOND NORMAL FORM (2NF)
Now break the SALES relation into two new relations so that partial
dependency does not exist.
SALESPERSON-ITEM (Emp-No, Item-No, Sale-Price)
ITEM-INFO (Item-No, Item-Description)
7/24/2017 43Md. Golam Moazzam, Dept. of CSE, JU
44. Normalization
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
SALESPERSON-ITEM (Emp-No, Item-No, Sale-Price)
ITEM-INFO (Item-No, Item-Description)
THIRD NORMAL FORM (3NF)
Test Condition 3: Data anomalies occur? Transitive dependency exists?
Then i) Decompose the table into two new tables.
ii) Identify PK for each table.
In SALESPERSON relation, attribute Department is transitively
dependent on the PK Emp-No. This is shown below.
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
7/24/2017 44Md. Golam Moazzam, Dept. of CSE, JU
45. Normalization
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
SALESPERSON-ITEM (Emp-No, Item-No, Sale-Price)
ITEM-INFO (Item-No, Item-Description)
THIRD NORMAL FORM (3NF)
7/24/2017 45Md. Golam Moazzam, Dept. of CSE, JU
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
46. Normalization
SALESPERSON (Emp-No, Emp-Name, Store-Branch, Department)
SALESPERSON-ITEM (Emp-No, Item-No, Sale-Price)
ITEM-INFO (Item-No, Item-Description)
THIRD NORMAL FORM (3NF)
Now break the SALESPERSON relation into two new relations so that
transitive dependency does not exist.
SALESPERSON (Emp-No, Emp-Name, Store-Branch)
STORE (Store-Branch, Department)
7/24/2017 46Md. Golam Moazzam, Dept. of CSE, JU
47. Normalization
After 3NF, the new set of relations that we have obtained through the
normalization process does not exhibit any of the anomalies. That is,
we can insert, delete and update tuples without any of the side effects.
SALESPERSON (Emp-No, Emp-Name, Store-Branch)
STORE (Store-Branch, Department)
SALESPERSON-ITEM (Emp-No, Item-No, Sale-Price)
ITEM-INFO (Item-No, Item-Description)
7/24/2017 47Md. Golam Moazzam, Dept. of CSE, JU
48. Normalization
Data Anomalies in 3NF Relations
Example: Consider the MANUFACTURER relation shown below where
each manufacturer has a unique ID and name. Manufacturers produce
items (identified by their unique item numbers) in the amounts
indicated. Manufacturers may produce more than one item and
different Manufacturers may produce the same items.
MANUFACTURER
7/24/2017 48Md. Golam Moazzam, Dept. of CSE, JU
ID Name Item-No Quantity
M101 Electronics USA H3552 1000
M101 Electronics USA J08732 500
M101 Electronics USA Y23490 200
M322 Electronics-R-Us H3552 900
49. Normalization
Data Anomalies in 3NF Relations
– This MANUFACTURER relation has two candidate keys:
(ID, Item-No) and (Name, Item-No)
that overlap on the attribute Item-No.
– The relation is in 3NF because there is only one nonprime attribute
and therefore it is impossible that this attribute can determine
another nonprime attribute.
– The relation MANUFACTURER is susceptible to update
anomalies. Consider for example the case in which one of the
manufacturers changes its name. If the value of this attribute is not
changed in all of the corresponding tuples there is not possibility of
having an inconsistent database.
7/24/2017 49Md. Golam Moazzam, Dept. of CSE, JU
50. Normalization
Boyce-Codd Normal Form
– A relation r(R) is in Boyce-Codd Normal Form (BCNF) if and only
of the following conditions are met simultaneously:
• The relation is in 3NF.
• For every functional dependency of the form X → A, we have
that either A X or X is a super key of r. In other words, every
functional dependency is either a trivial dependency or in the
case that the functional dependency is not trivial, then X must
be a super key.
7/24/2017 50Md. Golam Moazzam, Dept. of CSE, JU
51. Normalization
Boyce-Codd Normal Form
– To transform the relation of example into BCNF, we can
decompose it onto the following set of relational schemes:
Set No. 1
– MANUFACTURER (ID, Name)
– MANUFACTURER-PART (ID, Item-No, Quantity)
OR, Set No. 2
– MANUFACTURER (ID, Name)
– MANUFACTURER-PART (Name, Item-No, Quantity)
7/24/2017 51Md. Golam Moazzam, Dept. of CSE, JU
52. Normalization
Decomposition: Lossless or Lossy ?
– Whenever a relation is decomposed it is necessary to
ensure that the data in the original relation is represented
faithfully. That is, we need to make sure that we can
recover the original relation from the new relations that
have replaced it.
– Generally, the original relation is recovered by forming
the natural join of the new relations. If we can recover
the original relation we say that the decomposition is
lossless. Otherwise, it is lossy.
7/24/2017 52Md. Golam Moazzam, Dept. of CSE, JU
53. Normalization
Decomposition: Lossless or Lossy ?
Example: Consider the relation r shown below and its decomposition
R1 and R2. Is this decomposition lossless or lossy?
r R1 R2
7/24/2017 53Md. Golam Moazzam, Dept. of CSE, JU
X Y Z
x1 y1 z1
x2 y2 z2
x3 y2 z3
x4 y3 z4
X Y
x1 y1
x2 y2
x3 y2
x4 y3
Y Z
y1 z1
y2 z2
y2 z3
y3 z4
Decompose
54. Normalization
Lossless or Lossy Decomposition ?
r R1 R2
7/24/2017 54Md. Golam Moazzam, Dept. of CSE, JU
X Y Z
x1 y1 z1
x2 y2 z2
x3 y2 z3
x4 y3 z4
X Y
x1 y1
x2 y2
x3 y2
x4 y3
Y Z
y1 z1
y2 z2
y2 z3
y3 z4
Decompose
X Y Z
x1 y1 z1
x2 y2 z2
x2 y2 z3
x3 y2 z2
x3 y2 z3
x4 y3 z4
R1 Join R2
55. Normalization
Lossless or Lossy Decomposition ?
Example: Consider the relation r shown below and its decomposition
R1 and R2. Is this decomposition lossless or lossy?
Notice that the natural join of R1 and R2 has tuples that were not
present in the original relation. These tuples are called spurious tuples
because they represent spurious or false information. Since the
natural join of R1 and R2 does not recover the original relation, the
decomposition is lossy.
7/24/2017 55Md. Golam Moazzam, Dept. of CSE, JU