Normalization
Normalization
By KBS
Purpose of Normalization
By KBS
Database Modeling Life Cycle Step-By-Step
Write down the problem definition / requirements in detail.
Identify the nouns, they are the candidates for being entities.
Identify the characteristic properties of these nouns, they are the candidates for being
the attributes of the entities.
Carryout Normalization
By KBS
Anomalies
Anomalies : are problems that arise in the data due to a
flaw in the database design.
By KBS
Example of Update Anomalies
StaffBranch
By KBS
Example of Update Anomalies
StaffBranch
staffNo sName position salary branchNo bAddress
SL21 John White Manager 30000 B005 22 Deer Rd, London
SG37 Ann Beech Assistant 12000 B003 163 Main St,Glasgow
SG14 David Ford Supervisor 18000 B003 163 Main St,Glasgow
SA9 Mary Howe Assistant 9000 B007 16 Argyll St, Aberdeen
SG5 Susan Brand Manager 24000 B003 163 Main St,Glasgow
SL41 Julie Lee Assistant 9000 B005 22 Deer Rd, London
By KBS
Student-courses
Sid Sname Phone Courses-taken
100 John 487 2454 St-100-courses-taken
200 Smith 671 8120 St-200-courses-taken
300 Russell 871 2356 St-300-courses-taken
St-100-Course-taken
Course-id Course-description Credit-hours Grade
IS380 Database Concepts 3 A
IS416 Unix Operating System 3 B
St-200-Course-taken
Course-id Course-description Credit-hours Grade
IS380 Database Concepts 3 B
IS416 Unix Operating System 3 B
IS420 Data Net Work 3 C
St-300-Course-taken
Course-id Course-description Credit-hours Grade
IS417 System Analysis 3 A
By KBS
Definition of the three types of anomalies:
Insertion anomaly means that that some data can not be inserted in the database.
For example we can not add a new course to the database of above example,
unless we insert a student who has taken that course.
Thus Student-courses
Update table
anomaly means we have data redundancy suffers
in the database andfrom
to make
any modification we have to change all copies of the redundant data or else the
all the
databasethree anomalies
will contain incorrect data. .
For example in our database we have the Course description "Database Concepts"
for IS380 appears in both St-100-Course-taken and St-200-Course-taken tables.
To change its description to "New Database Concepts" we have to change it in all
places.
Deletion anomaly means deleting some data cause other information to be lost.
For example if student Russell is deleted from St-100-Course-taken table we also
lose the information that we had a course call IS417 with description System
Analysis.
By KBS
Deletion Anomaly
Occurs when the removal of a record results in a loss of important
information about an entity.
Example:
Solution:
Create two tables--one table contains order information and
the other table contains customer information
By KBS
Update Anomaly
Occurs when a change of a single attribute in one record
requires changes in multiple records
Example:
A staff person changes their telephone number and every potential
customer that person ever worked with has to have the corrected
number inserted.
Solution:
Put the employees telephone number in one location--as an attribute
in the employee table.
By KBS
Insertion Anomaly
Occurs when there does not appear to be any reasonable
place to assign attribute values to records in the database.
Example:
Adding new attributes or entire records when they are not
needed.
Solution:
Create a new table with a primary key that contains the
relevant or functional dependent attributes.
By KBS
A Relational State
Name Course Ph-No Major Prof. Grade
Rohit CS203 696453 Comp. Rajat A
Nath CS303 427739 Chemi. Bharat B
Rohit CS328 696453 Comp. Rajat B
Martin CS303 388518 Physics Bharat A
Martin CS503 388518 Physics Shyam In Pr
Rohit CS492 696453 Comp. Cross In Pr
Baxter CS379 831803 English Rod C
By KBS
A Relational State
Name Course Ph-No Major Prof. Grade
Rohit CS203 696453 Comp. Rajat A
Nath CS303 427739 Chemi. Bharat B
Rohit CS328 696453 Comp. Rajat B
The instance in
Martin CS303 388518
which thePhysics
data Bharat A
base is
Martin CS503 388518 Physics Shyam
currently
In Pr
Rohit CS492 696453 Comp. Cross In Pr
Baxter CS379 831803 English Rod C
By KBS
PROBLEMS
Redundancy
Update Anomalies
Insertion Anomalies
Deletion Anomalies
By KBS
STUDENTS Relation
Redundancy
Name Course OfPh-No
Data Major Prof. Grade
Rohit CS203 696453 Comp. Rajat A
Nath CS303 427739 Chemi. Bharat B
Rohit CS328 696453 Comp. Rajat B
Martin CS303 388518 Physics Bharat A
Martin CS503 388518 Physics Shyam In Pr
Rohit CS492 696453 Comp. Cross In Pr
Baxter CS379 831803 English Rod C
By KBS
STUDENTS Relation
Update
Anomalies
Name Course Ph-No Major Prof. Grade
Rohit CS203 696455 Comp. Rajat A
Nath CS303 427739 Chemi. Bharat B
Rohit696453
CS328 696455 Comp. Rajat B
Martin CS303 388518 Physics Bharat A
Martin CS503 388518 Physics Shyam In Pr
Rohit CS492 696453 Comp. Cross In Pr
Baxter CS379 831803 English Rod C
By KBS
STUDENTS Relation
Name Course Ph-No Major Prof. Grade
Rohit CS203 696453 Comp. Rajat A
Nath CS303 427739 Chemi. Bharat B
Rohit CS328 696453 Comp. Rajat B
Martin CS303 388518 Physics Bharat A
Insertion
Martin CS503 388518 Physics Shyam In Pr
Anomalies
Rohit CS492 696453 Comp. Cross In Pr
Baxter CS379 831803 English Rod C
Rohit CS500 Vijay
By KBS
STUDENTS Relation
Redundancy
Of Data
Name Course Ph-No Major Prof. Grade
Rohit CS203 696453 Comp. Rajat A
Nath CS303 427739 Chemi. Bharat B
Rohit CS328 696453 Comp. Rajat B
Martin CS303 388518 Physics Bharat A
Martin CS503 388518 Physics Shyam In Pr
Rohit CS492 696453 Comp. Cross In Pr
Baxter CS379 831803 English Rod C
By KBS
STUDENTS Relation
Name Course Ph-No Major Prof. Grade
Rohit CS203 696453 Comp. Rajat A
Nath CS303 427739 Chemi. Bharat B
Deletion
RohitAnomalies
CS328 696453 Comp. Rajat B
Martin CS303 388518 Physics Bharat A
Martin CS503 388518 Physics Shyam In Pr
Rohit CS492 696453 Comp. Cross In Pr
Baxter CS379 831803 English Rod C
By KBS
Redundancy and Data Anomalies
Redundant data is where we have stored the same ‘information’ more
than once. i.e., the redundant data could be removed without the loss
of information.
Example: We have the following relation that contains staff and department details:
Example: We have the following relation that contains staff and department details
and a list of telephone contact numbers for each member of staff.
By KBS
Normalization :-The Solution
Normalization is a process we can use to remove design flaws from a
database
sets of rules describing what we should and should not do in our table
structures
process consists of breaking tables into smaller tables that form a better
design
In this process :
Take database design through the different forms in order
form subsumes the one below it
At each stage, we add more rules that the schema must satisfy
By KBS
Normalization
In the design of a relational database management system (RDBMS), the
process of organizing data to minimize redundancy is called
normalization.
By KBS
There are two goals of the normalization process:-
Eliminating redundant data (for example, storing the same data in more
than one table) and
Ensuring data dependencies make sense (only storing related data in a
table).
By KBS
Purpose of Normalization
To avoid redundancy by storing each ‘fact’ within the
database only once.
By KBS
Functional Dependencies
The concept of functional dependency (also known as
normalization was introduced by professor Codd in 1970 when
he defined the first three normal forms (first, second and third
normal forms)
Plays a key role in differentiating good database design and bad
database design
Functional dependency describes the relationship between
attributes in a relation.
For example, if A and B are attributes of relation R, and B is
functionally dependent on A ( denoted A B),
if each value of A is associated with exactly one value of B. ( A
and B may each consist of one or more attributes.)
B is functionally dependent on A
A B
Refers to the attribute or group of attributes on the
Determinant
left-hand side of the arrow of a functional
dependency By KBS
Definition
A functional dependency is defined as a
constraint between two sets of attributes in a
relation from a database.
Given a relation R,
a set of attributes X in R is said to functionally
determine another attribute Y, also in R, (written X
→ Y) if and only if each X value is associated with
at most one Y value.
By KBS
In other words….
X is the determinant set and Y is the dependent
attribute.
By KBS
Example
Employee
Note:
Name is functionally dependent on SSN because an employee’s
name can be uniquely determined from their SSN.
SSN Name
Name does not determine SSN, because more than one employee
can have the same name.. Name SSN
By KBS
Example:
Functional Dependencies
staffNo job dept dname
SL10 Salesman 10 Sales
staffNo job
SA51 Manager 20 Accounts staffNo dept
DS40 Clerk 20 Accounts staffNo dname
OS45 Clerk 30 Operations dept dname
By KBS
Example
SSN LASTNAME
LASTNAME FIRSTNAME
By KBS
Dependency Diagram
Phone
Name
Major
Course
Prof.
Key Attributes
By KBS
Functional Dependencies
Trival functional dependency means that the right-hand side is a
subset ( not necessarily a proper subset) of the left- hand side.
staffNo sName position salary branchNo bAddress
SL21 John White Manager 30000 B005 22 Deer Rd, London
SG37 Ann Beech Assistant 12000 B003 163 Main St,Glasgow
SG14 David Ford Supervisor 18000 B003 163 Main St,Glasgow
SA9 Mary Howe Assistant 9000 B007 16 Argyll St, Aberdeen
SG5 Susan Brand Manager 24000 B003 163 Main St,Glasgow
SL41 Julie Lee Assistant 9000 B005 22 Deer Rd, London
• are nontrivial.
By KBS
Closure of Functional Dependencies
By KBS
Armstrong’s axioms
Developed by Armstrong in 1974, there are six
rules(axioms) that all possible functional dependencies
may be derived from them.
By KBS
4. Union Rule ---
If X Y and X Z holds,
then X YZ holds.
By KBS
※ Procedure for Computing F+
To compute the closure of a set of functional dependencies F:
repeat
for each functional dependency f in F+
apply reflexivity and augmentation rules on f
add the resulting functional dependencies to F +
for each pair of functional dependencies f1and f2 in F +
if f1 and f2 can be combined using transitivity
then add the resulting functional dependency to F +
until F + does not change any further
Example
R = (A, B, C, G, H, I)
F={ AB
AC
CG H
CG I
BH}
some members of F+
AH
by transitivity from A B and B H
AG I
by augmenting A C with G, to get AG CG
7845 Dave Turco 541 Bio 10 San Diego, L. Talip B24 Room 210
CA
By KBS
Based on the rules provided, the following dependencies can be
derived.
By KBS
Minial Sets of Functional Dependencies
By KBS
Example of A Minial Sets of Functional Dependencies
staffNo sName
staffNo position
staffNo salary
staffNo branchNo
staffNo bAddress
branchNo bAddress
branchNo, position salary
bAddress, position salary
By KBS
Closure of Attribute Sets
Given a set of attributes define the closure of under F (denoted by
+) as the set of attributes that are functionally determined by under F
(AG)+
1. result = AG
2. result = ABCG (A C and A B)
3. result = ABCGH (CG H and CG AGBC)
4. result = ABCGHI (CG I and CG AGBCH)
(AG)+ = ABCGHI
AG is super key
But if (AG)+ is a subset of super key then it’s a candidate key
What is Decomposition?
Decomposition – the process of breaking down in
parts or elements.
By KBS
What is lossless?
Lossless means functioning without a loss.
Repetition of information.
Loss of information.
By KBS
Representation of Information
Suppose we have a schema, bank_schema,
By KBS
Let's analyze this problem:
By KBS
Definition of Decomposition
Let R be a relation schema
A set of relation schemas { R1, R2,…, Rn } is a
decomposition of R if
R = R1 U R2 U …..U Rn
each Ri is a subset of R ( for i = 1,2…,n)
By KBS
Example of Decomposition
For relation R(x,y,z) there can be 2 subsets:
R1(x,z) and R2(y,z)
By KBS
Goal of Decomposition
Eliminate redundancy by decomposing a relation
into several relations in a higher normal form.
It is important to check that a decomposition
does not lead to bad design
By KBS
Problem with Decomposition
Given instances of the decomposed
relations, we may not be able to reconstruct
the corresponding instance of the original
relation – information loss
By KBS
Example : Problem with Decomposition
R
Model Name Price Category
a11 100 Canon
s20 200 Nikon
a70 150 Canon
R1 R2
Model Name Category Price Category
By KBS
Example : Problem with Decomposition
R1 U R2 Model Name Price Category
a11 100 Canon
a11 150 Canon
s20 200 Nikon
a70 100 Canon
a70 150 Canon
By KBS
Lossy decomposition
In previous example, additional tuples are
obtained along with original tuples
By KBS
Lossy decomposition (more example)
Functional dependencies:
By KBS
Lossy decomposition
Decomposition of the previous relation
T
Employee Project Branch
Brown Mars L.A.
Green Jupiter San Jose
Green Venus San Jose
Hoskins Saturn San Jose
Hoskins Venus San Jose
T1 T2
Employee Branch Project Branch
Brown L.A Mars L.A.
Jupiter San Jose
Green San Jose
Saturn San Jose
Hoskins San Jose
Venus San Jose
By KBS
Lossy decomposition
After Natural Join Original Relation
Employee Project Branch Employee Project Branch
Brown Mars L.A. Brown Mars L.A.
Green Jupiter San Jose Green Jupiter San Jose
Green Venus San Jose Green Venus San Jose
Hoskins Saturn San Jose Hoskins Saturn San Jose
Hoskins Venus San Jose Hoskins Venus San Jose
Green Saturn San Jose
Hoskins Jupiter San Jose
By KBS
Lossless Decomposition
A decomposition {R1, R2,…, Rn} of a
relation R is called a lossless decomposition
for R if the natural join of R1, R2,…, Rn
produces exactly the relation R.
By KBS
Lossless Decomposition
A decomposition is lossless if we can recover:
R(A, B, C)
Decompose
R1(A, B) R2(A, C)
Recover
R’(A, B, C)
Thus, R’ = R
By KBS
Lossless Decomposition
A decomposition is lossless if we can recover:
R(A,B,C)
Decompose
R1(A,B) R2(A,C)
Recover
By KBS
Example : Lossless Decomposition
Given:
bank_schema = (branch-name, branch-city, assets, customer-name,
loan-number, amount)
Required FD’s:
branch-name branch-city, assets
loan-number amount, branch-name
Decompose bank_schema into two schemas:
Branch-schema = (branch-name, branch-city, assets)
Loan-info-schema = (branch-name, customer-name, loan-number,
amount)
By KBS
Example : Lossless Decomposition
Show that decomposition is Lossless Decomposition
By KBS
Algorithm to test for the lossless and lossy decomposition
Input: A universal relation R,
a decomposition D = {R1, R2, …, Rm} of R,
and a set F of functional dependencies
1.Create an initial matrix S with one row i for each relation Ri in D, and
one column j for each attribute Aj in R.
2. Set S(i, j) = bij for all matrix entries.
/* each bij is a symbol associated with indices (i, j)*/
3. For each row i representing relation schema Ri
For each column j representing attribute Aj
if (relation Ri includes attribute Aj) then S(i, j) = aj
/* each aj is a symbol associated with index j */
By KBS
4. Repeat until a complete loop execution results in no changes to S
for each functional dependency X Y in F
for all rows in S which have the same symbols in the
columns corresponding to attributes in X
make the symbols in each column that correspond
to an attribute in Y be the same in all these rows as
follows:
If any of the rows has an “a” symbol for the
column, set the other rows to that same “a”
symbol in the column.
if no “a” symbol exists for the attribute in any of the rows, choose
one of the “b” symbols that appear in one of the rows for the
attribute and set the other rows to that same “b” symbol in the
column
By KBS
5. If a row is made up entirely of “a” symbols, then the
decomposition has the lossless join property; otherwise it does
not.
By KBS
Example of a Lossless Decomposition
By KBS
Create the matrix S
SSN EName PNum PName PLoc Hrs
R1 a1 a2 b13 b14 b15 b16
R2 b21 b22 a3 a4 a5 b26
R3 a1 b32 a3 b34 b35 a6
Apply f1: SSN EName
The values in the SSN column are the same for rows R1 and R3. In
the EName column, the values are a2 and b32.
Since an “a” symbol appears, change the R3, EName entry in S to
be a2. The resulting matrix S is
By KBS
Apply f2: PNum {PName, PLoc}
The values in the PNum column are the same for rows R2 and R3. In
the PName column, the values are a4 and b34.
Since an “a” symbol appears, change the R3, PName entry in S to be
a4. In the PLoc column, the values are a5 and b35. Change the R3,
PLoc entry to be a5.
The resulting matrix S is
By KBS
Apply f1: A1{A3, A5}
The values in the A1 column are the same for rows R1 ,R2 .
In the A3 column, the values are a3,a3 respectively.
Since an “a” symbol appears more than one row in column A1,
change in A5 entry in R2 to be a5. The resulting matrix S is
A1 A2 A3 A4 A5
R1 a1 a2 a3 b14 a5
Decomposition is Lossless
R2 a1 b22 a3 a4 b25 a5
R3 b31 b32 b33 a4 a5
Lossless decomposition ensure that the information in the original relation can be
accurately reconstructed based on the information represented in the decomposed
relations.
By KBS
Extraneous Attributes
Consider F, and a functional dependency, A B.
{A B, B C, A D}
E.g.: {A B, B C, AC D} can be simplified to
{A B, B C, A D}
By KBS
Stages of Normalisation
Un-normalised
(UNF)
Remove repeating groups
First normal form
(1NF)
Remove partial dependencies
Second normal form
(2NF)
Remove transitive dependencies
Third normal form
(3NF) Remove remaining functional
dependency anomalies
Boyce-Codd normal
form (BCNF)
Remove multivalued dependencies
Fourth normal form
(4NF)
Remove remaining anomalies
Fifth normal form
(5NF) By KBS
Unnormalised Normal Form (UNF)
Definition:-
A relation is un-normalised when it has not any normalization
rules applied to it, and it suffers from various anomalies.
ORDER
Customer No: 001964 Order Number: 00012345
Name: Mark Campbell Order Date: 14-Feb-2002
Address: 1 The House
Leytonstone
E11 9ZZ
By KBS
By KBS
First Normal Form (1NF)
Definition: A relation is in 1NF if, and only if, all its
underlying attributes contain atomic values only.
Remove repeating groups into a new relation
First Normal Form is a relation in which the intersection of
each row and column contains one and only one value.
By KBS
Example:
A table for the entity of Book
By KBS
By applying the first normal form,
we will have to construct separate tables for the redundant data
with extra tables to define the relationship between the tables.
By KBS
Since the tables had separated in order to avoid redundancy.
we also need to create new tables to connect each table so that
their relationship between each table will remain unchanged.
ISBN Author_ID
0-07-295886-3 1
0-07-240500-7 3
0-07-295886-3 2
0-07-240500-7 4
* Here we have the relationship between the book and the author.
ISBN Subject_ID
0-07-295886-3 1
0-07-240500-7 2
* Here we have the relationship between the book and the subject .
By KBS
A table is in first normal form (1NF) if there are no repeating
groups.
A repeating group is a set of logically related fields or values
that occur multiple times in one record.
EMPLOYEES_PROJECTS_TIME
EmployeeID Name Project Time
30-452-T3, 0.25,
EN1-26 Sean O'Brien 30-457-T3, 0.40,
32-244-T3 0.30
30-452-T3, 0.05,
EN1-33 Amy Guya 30-382-TC, 0.35,
32-244-T3 0.60
30-452-T3, 0.15,
EN1-35 Steven Baranco
31-238-TC 0.80
EN1-36 Elizabeth Roslyn 35-152-TC 0.90
EN1-38 Carol Schaaf 36-272-TC 0.75
31-238-TC, 0.20,
EN1-40 Alexandra Wing
31-241-TC 0.70
The above tables below do not comply with first normal form.
Look for fields that contain too much data and repeating group of fields .
By KBS
The example above is also related to another design issue,
namely,
That each field should hold the smallest meaningful value and
that there should not be multiple values in a single field.
By KBS
First Normal Form
By KBS
Requirements
No redundant data
By KBS
Second Normal Form (2NF)
Def: A table is in 2NF if it is in 1NF and if all non-key
attributes are dependent on all of the key.
It has no partial dependency.
Second Normal Form(2NF) remove partial dependency.
Partial dependency:-
Partial dependency occurs when the value in a non-key
attribute of a table is dependent on the value of some part of
the table’s primary key(but not all of it)
Partial Dependency
CUSTOMER
Cust_no
Qty
Title
ISBN
Author_name
Relation is decompose in to two relation
Author_countory
Sales(cust_no,ISBN,Qty)
Unit price
Book_sale(ISBN,title,Authore_name,Autho
re_countory,unitprice)
By KBS
Employee_project
A table with a multi-field primary key and repeating data in non-key fields
*EmployeeID LastName FirstName *ProjectNumber ProjectTitle
EN1-26 O'Brien Sean 30-452-T3 STAR manual
EN1-26 O'Brien Sean 30-457-T3 ISO procedures
Employee
EN1-26 O'Brien Sean 31-124-T3
handbook
EN1-33 Guya Amy 30-452-T3 STAR manual
EN1-33 Guya Amy 30-482-TC Web Site
EN1-33 Guya Amy 31-241-TC New catalog
EN1-35 Baranco Steven 30-452-T3 STAR manual
EN1-35 Baranco Steven 31-238-TC STAR prototype
EN1-36 Roslyn Elizabeth 35-152-TC STAR pricing
EN1-38 Schaaf Carol 36-272-TC Order system
EN1-40 Wing Alexandra 31-238-TC STAR prototype
EN1-40 Wing Alexandra 31-241-TC New catalog
multi-field primary key is necessary because neither the
EmployeeID nor the ProjectNum fields contain unique values.
Non-key fields relate to only part of the primary key.
They are not functionally dependent on the entire primary key.
The solution to this lies in breaking the table into smaller
tables that do meet second normal form
By KBS
EMPLOYEES *EmployeeID Last Name First Name
EN1-26 O'Brien Sean
EN1-33 Guya Amy
EN1-35 Baranco Steven
EN1-36 Roslyn Elizabeth
EN1-38 Schaaf Carol
EN1-40 Wing Alexandra
By KBS
Second Normal Form
By KBS
Third Normal Form (3NF)
A table is in second normal form (2NF) and there are no
transitive dependencies.
Authore_countory
Unit_price
By KBS
Transitive
Dependency
EMPLOYEE
By KBS
Book_sale(ISBN,title,Authore_name,Authors_country,unitprice)
Book(ISBN,Title,UnitPrice ,Authore_name)
Author(Author_name,Author_country)
By KBS
Project_manager
A table with a single field primary key and repeating values in non-key fields.
*ProjectNum ProjectTitle ProjectMgr Phone
30-452-T3 STAR manual Garrison 2756
30-457-T3 ISO procedures Jacanda 2954
30-482-TC Web site Friedman 2846
31-124-T3 Employee handbook Jones 3102
31-238-TC STAR prototype Garrison 2756
31-241-TC New catalog Jones 3102
35-152-TC STAR pricing Vance 3022
36-272-TC Order system Jacanda 2954
By KBS
Complying with third normal form Foreign key
PROJECTS
*ProjectNum ProjectTitle ProjectMgr
30-452-T3 STAR manual Garrison
30-457-T3 ISO procedures Jacanda
By KBS
Third Normal Form
By KBS
Requirements
By KBS
Boyce-Codd Normal Form (BCNF)
Definition:
A relation is in Boyce-Codd Normal Form (BCNF) if every
determinant is a candidate key.
Determinant is a column on which some of the columns are
fully functional dependent.
Candidate key is minimal subset of super key.
E.g;-Roll_no and {student_name,student_address) are
candidate key .
Roll_no is use to uniquely identify the records and
combination of student_name & student_address are also used
for unique record .
But {Roll_no,student_name} is not a candidate key because
Roll_no is candidate key.
By KBS
Examples:
Consider a database table that stores employee information.
By KBS
Boyce-Codd normal form (BCNF)
By KBS
Example of BCNF(1)
ClientInterview
StaffRoom
staffNo interviewDate roomNo
SG5 13-May-02 G101
SG37 13-May-02 G102
SG5 1-Jul-02 G102
By KBS
Example of BCNF(2)
Consider relational table SUPPLIERS
Functional Dependencies:
supplier_no city
supplier_no zip
supplier_no supplier_name
supplier_name city
supplier_name zip
supplier_name supplier_no
The relation is in BCNF since both determinants (supplier_no and
supplier_name) are unique (i.e., are candidate keys).
By KBS
Note that even relations in BCNF can have anomalies.
Anomalies:
INSERT: We cannot record the city for a supplier_no without also
knowing the supplier_name
Decomposition:
By KBS
Fourth Normal Form (4NF)
Def:
A table is in 4NF if it is in BCNF and if it has no multi-valued
dependencies.
By KBS
Consider this example of a database of teaching courses, the
books recommended for the course, and the lecturers who will
be teaching the course:
Course_book_lecturer
Course Book Lecturer
AHA Silberschatz John D
AHA Nederpelt William M
AHA Silberschatz William M
AHA Nederpelt John D
AHA Silberschatz Christian G
AHA Nederpelt Christian G
OSO Silberschatz John D
OSO Silberschatz William M
Course_book_lecturer.Course Book
Course_book_lecturer.Course Lecturer
By KBS
Example:- Pizza Delivery Permutations
Restaurant Pizza Variety Delivery Area
A1 Pizza Thick Crust Springfield
A1 Pizza Thick Crust Shelbyville
A1 Pizza Thick Crust Capital City
A1 Pizza Stuffed Crust Springfield
A1 Pizza Stuffed Crust Shelbyville
A1 Pizza Stuffed Crust Capital City
Elite Pizza Thin Crust Capital City
Elite Pizza Stuffed Crust Capital City
Vincenzo's Pizza Thick Crust Springfield
Vincenzo's Pizza Thick Crust Shelbyville
Vincenzo's Pizza Thin Crust Springfield
Vincenzo's Pizza Thin Crust Shelbyville
The dependencies are:
{Restaurant} {Pizza Variety}
{Restaurant} {Delivery Area}
By KBS
To eliminate the possibility of these anomalies, we must place
the facts about varieties offered into a different table from the
facts about delivery areas,
Two tables that are both in 4NF:
Varieties By Restaurant Delivery Areas By Restaurant
By KBS
Fifth Normal Form (5NF)
Fifth normal form (5NF), also known as Project-join
normal form (PJ/NF) is a level of database normalization
designed to reduce redundancy in relational databases.
By KBS
There are some relation which cannot be decomposed in to two
projection.
But these relations can be decomposed into three relation this is
in 5NF.
Suppose there is a relation Dealer_parts_customer
Dealer Parts customer
D1 P1 C1
D1 P1 C2
D1 P2 C1
D2 P1 C1
Customer_Dealer
customer Dealer
C1 D1
C2 D1
C1 D2
If we join three table we obtained original relation.
If we join two relation we can not obtained original relation.
This is called join dependency.
By KBS
End of Unit-I
By KBS