SlideShare a Scribd company logo
Functional Dependency
and
Normalization
7/24/2017 1Md. Golam Moazzam, Dept. of CSE, JU
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
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
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
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
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
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
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

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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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

Normalization
Partial Dependencies
PROJECT-EMPLOYEE (Proj-ID, Emp-ID, Emp-Name, Emp-Dpt,
Emp-Hrly-rate, Total-Hrs)
7/24/2017 28Md. Golam Moazzam, Dept. of CSE, JU
Emp-Id
Proj-Id
Emp-Name
Emp-Dpt
Emp-Hrly-Rate
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
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)
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
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
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
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
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
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
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)
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.
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
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
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
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)
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
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
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)
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
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
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
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
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
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
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
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
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
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

More Related Content

What's hot

Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Oum Saokosal
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
Harsiddhi Thakkar
 
Database language
Database languageDatabase language
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
Drishti Bhalla
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
Oum Saokosal
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
Pradnya Saval
 
Lossless decomposition
Lossless decompositionLossless decomposition
Lossless decomposition
MANASYJAYASURYA
 
1.4 data independence
1.4 data independence1.4 data independence
1.4 data independence
BHARATH KUMAR
 
EER modeling
EER modelingEER modeling
EER modeling
Dabbal Singh Mahara
 
Dtd
DtdDtd
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationshipswmassie
 
Normal forms
Normal formsNormal forms
Normal forms
Samuel Igbanogu
 
Database User and Administrator
Database User and AdministratorDatabase User and Administrator
Database User and Administrator
A. S. M. Shafi
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management System
Kevin Jadiya
 
Fundamentals of Database system
Fundamentals of Database systemFundamentals of Database system
Fundamentals of Database system
philipsinter
 
Er diagram
Er diagramEr diagram
Er diagram
Sabana Maharjan
 
The Relational Model
The Relational ModelThe Relational Model
The Relational Model
Bhandari Nawaraj
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mappingsaurabhshertukde
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
soniyagoyal3
 

What's hot (20)

Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
 
Unit05 dbms
Unit05 dbmsUnit05 dbms
Unit05 dbms
 
Database language
Database languageDatabase language
Database language
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
Lossless decomposition
Lossless decompositionLossless decomposition
Lossless decomposition
 
1.4 data independence
1.4 data independence1.4 data independence
1.4 data independence
 
EER modeling
EER modelingEER modeling
EER modeling
 
Dtd
DtdDtd
Dtd
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Normal forms
Normal formsNormal forms
Normal forms
 
Database User and Administrator
Database User and AdministratorDatabase User and Administrator
Database User and Administrator
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management System
 
Fundamentals of Database system
Fundamentals of Database systemFundamentals of Database system
Fundamentals of Database system
 
Er diagram
Er diagramEr diagram
Er diagram
 
The Relational Model
The Relational ModelThe Relational Model
The Relational Model
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
 

Similar to Functional dependency and normalization

Normalization
NormalizationNormalization
Normalization
Dabbal Singh Mahara
 
Dbms unit-3
Dbms unit-3Dbms unit-3
Dbms unit-3
MUKESH KUMAR
 
MODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.pptMODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.ppt
BelkinAntony1
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization Techniques
Nishant Munjal
 
DBMS unit-3.pdf
DBMS unit-3.pdfDBMS unit-3.pdf
DBMS unit-3.pdf
Prof. Dr. K. Adisesha
 
Database Management System [DBMS]
Database Management System [DBMS]Database Management System [DBMS]
Database Management System [DBMS]
Shalabh Chaudhary
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
Ajit Nayak
 
Chapter-8 Relational Database Design
Chapter-8 Relational Database DesignChapter-8 Relational Database Design
Chapter-8 Relational Database Design
Kunal Anand
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
KalpanaThakre2
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
amanchouhan9917
 
Dbms3
Dbms3Dbms3
DBMS Unit 3.pptx
DBMS Unit 3.pptxDBMS Unit 3.pptx
DBMS Unit 3.pptx
AmitDrKhare
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
Roshni Singh
 
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NFALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ijdms
 
Theory of dependencies in relational database
Theory of dependencies in relational databaseTheory of dependencies in relational database
Theory of dependencies in relational databaseJyoti Ranjan Pattnaik
 
Normalization
NormalizationNormalization
Normalization
Neethu Tressa
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptx
AbdusSadik
 

Similar to Functional dependency and normalization (20)

Normalization
NormalizationNormalization
Normalization
 
Dbms unit-3
Dbms unit-3Dbms unit-3
Dbms unit-3
 
MODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.pptMODULE 4 -Normalization_1.ppt
MODULE 4 -Normalization_1.ppt
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization Techniques
 
DBMS unit-3.pdf
DBMS unit-3.pdfDBMS unit-3.pdf
DBMS unit-3.pdf
 
Database Management System [DBMS]
Database Management System [DBMS]Database Management System [DBMS]
Database Management System [DBMS]
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
 
Chapter-8 Relational Database Design
Chapter-8 Relational Database DesignChapter-8 Relational Database Design
Chapter-8 Relational Database Design
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
 
Dbms3
Dbms3Dbms3
Dbms3
 
DBMS Unit 3.pptx
DBMS Unit 3.pptxDBMS Unit 3.pptx
DBMS Unit 3.pptx
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NFALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
 
Theory of dependencies in relational database
Theory of dependencies in relational databaseTheory of dependencies in relational database
Theory of dependencies in relational database
 
Normalization
NormalizationNormalization
Normalization
 
Cs501 fd nf
Cs501 fd nfCs501 fd nf
Cs501 fd nf
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptx
 

More from University of Potsdam

Computer fundamentals 01
Computer fundamentals 01Computer fundamentals 01
Computer fundamentals 01
University of Potsdam
 
Workshop on android apps development
Workshop on android apps developmentWorkshop on android apps development
Workshop on android apps development
University of Potsdam
 
Transparency and concurrency
Transparency and concurrencyTransparency and concurrency
Transparency and concurrency
University of Potsdam
 
Database System Architecture
Database System ArchitectureDatabase System Architecture
Database System Architecture
University of Potsdam
 
indexing and hashing
indexing and hashingindexing and hashing
indexing and hashing
University of Potsdam
 
data recovery-raid
data recovery-raiddata recovery-raid
data recovery-raid
University of Potsdam
 
Query processing
Query processingQuery processing
Query processing
University of Potsdam
 
Machine Learning for Data Mining
Machine Learning for Data MiningMachine Learning for Data Mining
Machine Learning for Data Mining
University of Potsdam
 
Tree, function and graph
Tree, function and graphTree, function and graph
Tree, function and graph
University of Potsdam
 
Sonet
SonetSonet
Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
University of Potsdam
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
University of Potsdam
 
Series parallel ac rlc networks
Series parallel ac rlc networksSeries parallel ac rlc networks
Series parallel ac rlc networks
University of Potsdam
 
Series parallel ac networks
Series parallel ac networksSeries parallel ac networks
Series parallel ac networks
University of Potsdam
 
Relations
RelationsRelations
Relations
RelationsRelations
Propositional logic
Propositional logicPropositional logic
Propositional logic
University of Potsdam
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
University of Potsdam
 
Prim algorithm
Prim algorithmPrim algorithm
Prim algorithm
University of Potsdam
 
Predicate & quantifier
Predicate & quantifierPredicate & quantifier
Predicate & quantifier
University of Potsdam
 

More from University of Potsdam (20)

Computer fundamentals 01
Computer fundamentals 01Computer fundamentals 01
Computer fundamentals 01
 
Workshop on android apps development
Workshop on android apps developmentWorkshop on android apps development
Workshop on android apps development
 
Transparency and concurrency
Transparency and concurrencyTransparency and concurrency
Transparency and concurrency
 
Database System Architecture
Database System ArchitectureDatabase System Architecture
Database System Architecture
 
indexing and hashing
indexing and hashingindexing and hashing
indexing and hashing
 
data recovery-raid
data recovery-raiddata recovery-raid
data recovery-raid
 
Query processing
Query processingQuery processing
Query processing
 
Machine Learning for Data Mining
Machine Learning for Data MiningMachine Learning for Data Mining
Machine Learning for Data Mining
 
Tree, function and graph
Tree, function and graphTree, function and graph
Tree, function and graph
 
Sonet
SonetSonet
Sonet
 
Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
Series parallel ac rlc networks
Series parallel ac rlc networksSeries parallel ac rlc networks
Series parallel ac rlc networks
 
Series parallel ac networks
Series parallel ac networksSeries parallel ac networks
Series parallel ac networks
 
Relations
RelationsRelations
Relations
 
Relations
RelationsRelations
Relations
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Prim algorithm
Prim algorithmPrim algorithm
Prim algorithm
 
Predicate & quantifier
Predicate & quantifierPredicate & quantifier
Predicate & quantifier
 

Recently uploaded

MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 

Recently uploaded (20)

MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 

Functional dependency and normalization

  • 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 
  • 28. Normalization Partial Dependencies PROJECT-EMPLOYEE (Proj-ID, Emp-ID, Emp-Name, Emp-Dpt, Emp-Hrly-rate, Total-Hrs) 7/24/2017 28Md. Golam Moazzam, Dept. of CSE, JU Emp-Id Proj-Id Emp-Name Emp-Dpt Emp-Hrly-Rate
  • 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