SlideShare a Scribd company logo
Ch-4
NORMALIZATION
AND
RELATIONAL ALGEBRA
Chapter 4: Normalization
 Why Normalization: Anomalies
 Functional Dependencies: Types
 Steps of Normalization
 Relational Algebra (Assignment)
Normalization
 After converting the ER diagram in to table
forms, the next phase is implementing the
process of normalization,
 which is a collection of rules each table should
satisfy.
 Normalization is a series of steps followed to
obtain a database design that allows for
consistent storage and efficient access of data
in a relational database.
 These steps reduce data redundancy and the
risk of data becoming inconsistent.
…Normalization
 One of the best ways to determine what information
should be stored in a database is
 to clarify what questions will be asked of it and
 what data would be included in the answers
 identifying the logical associations between data items
and
 designing a database that will represent such
associations but without suffering
1. Insertion Anomalies
2. Deletion Anomalies
3. Modification Anomalies
 Thus, the purpose of normalization is to reduce the
chances for anomalies to occur in a database.
Example of Anomalies on
Unnormalized database table
Anomalies
 Deletion Anomalies
 If employee with ID 16 is deleted then
 every information about skill C++ and
 the type of skill is deleted from the database.
 Then we will not have any information about C++ and its skill type.
 Insertion Anomalies
 What if we have a new employee with a skill Pascal?
 We cannot decide whether Pascal is allowed as a value for skill and
 we have no clue about the type of skill that Pascal should be categorized as.
 Modification Anomalies
 if the address for Helico is changed from Piazza to Mexico?
 We need to look for every occurrence of Helico School_Add from Piazza to
Mexico,
 which is prone to error.
Functional Dependency
(FD)
 Before moving to the definition and application
of normalization,
 it is important to have an understanding of
"functional dependency."
 Data Dependency: The logical associations
between data items that point the database
designer in the direction of a good database
design are referred to as determinant or
dependent relationships.
 Two data items A and B are said to be in a determinant or
dependent relationship if certain values of data item B
always appears with certain values of data item A
Functional
Dependency (FD)
 if the existence of something, call it A, implies
that B must exist and have a certain value, then
we say that "B is functionally dependent on A."
 We also often express this idea by saying that
 "A determines B," or
 "B is a function of A," or
 "A functionally governs B.“
 We ca express this as follows
 "If A, then B."
Functional
Dependency (FD)
 The notation is: A→B which is read as;
 B is functionally dependent on A
 In general, a functional dependency is a
relationship among attributes.
In relational databases, we can have a determinant
that governs one other attribute or several other
attributes.
NB: FDs are derived from the real-world
constraints on the attributes.
Functional dependency example
• Since both Wine type and Fork type are determined by the Dinner type, we
say
Wine is functionally dependent on Dinner and
Fork is functionally dependent on Dinner.
Dinner → Wine
Dinner → Fork
Types of dependency
 Partial Dependency
 If an attribute which is not a member of the
primary key is dependent on some part of the
primary key (if we have composite primary key)
then that attribute is partially functionally
dependent on the primary key.
 Let {A,B} is the Primary Key and C is non key
attribute.
 Then if {A, B} →C and B→C or A→C
 Then C is partially functionally dependent on {A, B}
Types of dependency
 Full Dependency
 If an attribute which is not a member of the
primary key is not dependent on some part of
the primary key but the whole key (if we have
composite primary key) then
 that attribute is fully functionally dependent on
the primary key.
 Let {A, B} is the Primary Key and C is a non key
attribute
 Then if {A, B} →C and B→C and A→C
 Then C Fully functionally dependent on {A, B}
Types of dependency
 Transitive Dependency
 "If A implies B, and if also B implies C, then A implies C."
Example:
 If Mr X is a Human, and if every Human is an Animal,
then Mr X must be an Animal.
 Generalized way of describing transitive dependency is
that:
If A functionally governs B, AND
If B functionally governs C
THEN A functionally governs C
 Provided that neither C nor B determines A i.e. (B /→ A
and C /→ A)
Types of dependency
In the normal notation:
 {(A→ B) AND (B→ C)} ==> A→C provided that
 B /→ A and
 C /→ A
Steps of Normalization
 We have various levels or steps in normalization called
Normal Forms.
 as we move from one lower level Normal Form to the
higher
 The level of complexity, strength of the rule and
decomposition increases.
 A table in a relational database is said to be in a certain
normal form if it satisfies certain constraints.
Steps in normalization
 Un-Normalized Form:
 Identify all data elements
 First Normal Form:
 Find the key with which you can find all data
 Second Normal Form:
 Remove part-key dependencies.
 Make all data dependent on the whole key.
 Third Normal Form
 Remove non-key dependencies.
 Make all data dependent on nothing but the key.
 For most practical purposes, databases are considered
normalized if they adhere to third normal form.
First Normal Form
(1NF)
 Definition: a table (relation) is in 1NF
If
 There are no duplicated rows in the table.
Unique identifier
 Each cell is single-valued (i.e., there are no
repeating groups).
 Entries in a column (attribute, field) are of
the same kind, i.e. the same domain or type.
First Normal Form
(1NF)
 We have two ways of achieving atomicity:
 Putting each repeating group into a separate
table and connecting them with a primary key-
foreign key relationship or
 Moving these repeating groups to a new row by
repeating the common attributes.
 If so then find the key with which you can find
all data
First Normal Form
(1NF)
First Normal Form (1NF)
 In 1NF:
 Remove all repeating groups.
 Distribute the multi-valued attributes into
different rows and
 identify a unique identifier
Second Normal Form
(2NF)
 Second Normal form 2NF
 No partial dependency of a non-key attribute on part
of the primary key.
 This will result in a set of relations with a level of
Second Normal Form.
 Any table that is in 1NF and has a single-attribute (i.e.,
a non-composite) primary key is automatically in 2NF.
 Definition: a table (relation) is in 2NF
If
It is in 1NF and
If all non-key attributes are dependent on the
entire primary key. i.e. no partial dependency.
Second Normal Form
(2NF)
 Example for 2NF:
• Business rule: Whenever an employee participates in a project,
• he/she will be entitled for an incentive.
• since we don’t have any repeating groups or attributes with multi-
valued property.
• This schema is in its 1NF
Second Normal Form
(2NF)
 To convert it to a 2NF
 we need to remove all partial dependencies of non-key
attributes on part of the primary key.
 {EmpID, ProjNo}→EmpName, ProjName, ProjLoc, ProjFund,
ProjMangID, Incentive
 But in addition to this we have the following dependencies
 FD1: {EmpID} → EmpName
 FD2: {ProjNo} → ProjName, ProjLoc, ProjFund,
ProjMangID
 FD3: {EmpID, ProjNo} → Incentive
 As we can see,
 some non-key attributes are partially dependent on some part
of the primary key.
 This can be witnessed by analyzing FD1 and FD2.
Second Normal Form
(2NF)
 Thus, each Functional Dependencies, with their
dependent attributes should be moved to a new
relation where the Determinant will be the
Primary Key for each.
Third Normal Form
(3NF)
 Third Normal Form (3NF)
 Eliminate Columns Dependent on another non-
Primary Key
 Definition: a Table (Relation) is in 3NF

If

It is in 2NF and

There are no transitive dependencies between
a primary key and non-primary key attributes.
 Example for (3NF)
 Assumption: Students of same batch (same
year) live in one building or dormitory
• This schema is in its 2NF.
• Let’s take StudID, Year and Dormitary and see the dependencies.
StudID→ Year AND
Year→ Dormitary And
Year cannot determine StudID and
Dormitary cannot determine StudID Then transitively
StudID→ Dormitary
• To convert it to a 3NF
• we need to remove
• all transitive dependencies i.e,. StudID→ Dormitary
• The non-primary key attributes, dependent on each other i.e.,
Year→ Dormitary
• will be moved to another table and linked with the main table using
Candidate Key- Foreign Key relationship.
Third Normal Form (3NF)
• Generally, even though there are other four additional levels of
Normalization, a table is said to be normalized if it reaches 3NF.
• A database with all tables in the 3NF is said to be Normalized
Database.
• Normalization up to 3NF should hold the following:
Third Normal Form (3NF)
Other Examples on
normalization
 Consider this Example:
Other Examples on normalization
Other Examples on
normalization
Other Examples on
normalization
Other Examples on
normalization
Other Examples on
normalization
 Generally we can have this
1)1. Given a relation R( A, B, C, D) and Functional Dependency set
FD = { AB → CD, B → C }, determine whether the given R is in
2NF? If not convert it into 2 NF.
2)2.Given a relation R( P, Q, R, S, T) and Functional Dependency
set FD = { PQ → R, S → T }, determine whether the given R is in
2NF? If not convert it into 2 NF.
Exercise
Questions1
Decomposed tables to be in 2NF includes as follows:
a) R1( B, C) b) R2(A, B, D)
Questions2:
Decomposed tables to be in 2NF includes as follows:
a) R1( P, Q, R) b) R2(S, T) c) R3(P, Q, S)

As we go to higher normal forms, we create a more number of
relations.

Each higher normal form removes a certain type of dependency
that causes redundancy.

As a relation becomes a higher normal form:

We have a more number of relations

That increases more number of joins in query forming

which increases more number of join processing

And also more referential integrity constraints need to be
maintained

And thus schema is complicated and performance is
decreased.
So, many real-world DB designers stop at 3NF, which reasonably
removes typical redundnacy and still maintains performance. So,
strive to achieve 3NF in your real-world RDB!
Normalization: Summary
Assignment
Relational algebra concepts

More Related Content

What's hot

Distributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - IntroductionDistributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - Introduction
Gyanmanjari Institute Of Technology
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
Megha Patel
 
Web data management (chapter-1)
Web data management (chapter-1)Web data management (chapter-1)
Web data management (chapter-1)
Dhaval Asodariya
 
Adbms lab manual
Adbms lab manualAdbms lab manual
Adbms lab manual
RAKESH KUMAR
 
Sql
SqlSql
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
pnp @in
 
Chapter-4 Enhanced ER Model
Chapter-4 Enhanced ER ModelChapter-4 Enhanced ER Model
Chapter-4 Enhanced ER Model
Kunal Anand
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
Ravinder Kamboj
 
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
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
maryeem
 
NoSql
NoSqlNoSql
EER modeling
EER modelingEER modeling
EER modeling
Dabbal Singh Mahara
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
Ramakant Soni
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
Eddyzulham Mahluzydde
 
Database Programming
Database ProgrammingDatabase Programming
Database Programming
Henry Osborne
 
SQL DDL
SQL DDLSQL DDL
SQL DDL
Vikas Gupta
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
Nishant Munjal
 
SQL Server Index and Partition Strategy
SQL Server Index and Partition StrategySQL Server Index and Partition Strategy
SQL Server Index and Partition Strategy
Hamid J. Fard
 

What's hot (20)

Distributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - IntroductionDistributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - Introduction
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Web data management (chapter-1)
Web data management (chapter-1)Web data management (chapter-1)
Web data management (chapter-1)
 
Adbms lab manual
Adbms lab manualAdbms lab manual
Adbms lab manual
 
Sql
SqlSql
Sql
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
 
Chapter-4 Enhanced ER Model
Chapter-4 Enhanced ER ModelChapter-4 Enhanced ER Model
Chapter-4 Enhanced ER Model
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
 
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
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
 
NoSql
NoSqlNoSql
NoSql
 
EER modeling
EER modelingEER modeling
EER modeling
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Dbms presentaion
Dbms presentaionDbms presentaion
Dbms presentaion
 
Database Programming
Database ProgrammingDatabase Programming
Database Programming
 
SQL DDL
SQL DDLSQL DDL
SQL DDL
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
SQL Server Index and Partition Strategy
SQL Server Index and Partition StrategySQL Server Index and Partition Strategy
SQL Server Index and Partition Strategy
 

Similar to Chapter – 4 Normalization and Relational Algebra.pdf

24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdf
Shivani139202
 
Normalisation
NormalisationNormalisation
Normalisation
Soumyajit Dutta
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
KalpanaThakre2
 
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
MisganawAbeje1
 
Normalization
NormalizationNormalization
Normalization
Dabbal Singh Mahara
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
Roshni Singh
 
Normalization
NormalizationNormalization
Normalization
Sakshi Jaiswal
 
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
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
amanchouhan9917
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
Pratik Devmurari
 
Penormalan/Normalization
Penormalan/NormalizationPenormalan/Normalization
Penormalan/Normalization
Joan Ador
 
Chapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptxChapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptx
haymanot taddesse
 
Relational database
Relational  databaseRelational  database
Relational database
amkrisha
 
DBMS unit-3.pdf
DBMS unit-3.pdfDBMS unit-3.pdf
DBMS unit-3.pdf
Prof. Dr. K. Adisesha
 
Normalization
NormalizationNormalization
Normalization
Mohd Mastana
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
Deependra35
 
Chapter10
Chapter10Chapter10
Chapter10
sasa_eldoby
 
b - Normalizing a Data Model
b - Normalizing a Data Modelb - Normalizing a Data Model
b - Normalizing a Data ModelDimara Hakim
 
Database Presentation
Database PresentationDatabase Presentation
Database Presentation
Malik Ghulam Murtza
 
DBMS Helping material
DBMS Helping materialDBMS Helping material
DBMS Helping material
ZarlishAttique1
 

Similar to Chapter – 4 Normalization and Relational Algebra.pdf (20)

24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdf
 
Normalisation
NormalisationNormalisation
Normalisation
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
 
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
 
Normalization
NormalizationNormalization
Normalization
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Normalization
NormalizationNormalization
Normalization
 
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
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
 
Penormalan/Normalization
Penormalan/NormalizationPenormalan/Normalization
Penormalan/Normalization
 
Chapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptxChapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptx
 
Relational database
Relational  databaseRelational  database
Relational database
 
DBMS unit-3.pdf
DBMS unit-3.pdfDBMS unit-3.pdf
DBMS unit-3.pdf
 
Normalization
NormalizationNormalization
Normalization
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
 
Chapter10
Chapter10Chapter10
Chapter10
 
b - Normalizing a Data Model
b - Normalizing a Data Modelb - Normalizing a Data Model
b - Normalizing a Data Model
 
Database Presentation
Database PresentationDatabase Presentation
Database Presentation
 
DBMS Helping material
DBMS Helping materialDBMS Helping material
DBMS Helping material
 

More from TamiratDejene1

Ch-3 lecture.pdf
Ch-3 lecture.pdfCh-3 lecture.pdf
Ch-3 lecture.pdf
TamiratDejene1
 
Chapter 2.pptx
Chapter 2.pptxChapter 2.pptx
Chapter 2.pptx
TamiratDejene1
 
Wireless LANs.ppt
Wireless LANs.pptWireless LANs.ppt
Wireless LANs.ppt
TamiratDejene1
 
Data Link Control.ppt
Data Link Control.pptData Link Control.ppt
Data Link Control.ppt
TamiratDejene1
 
Congestion Control and QOS.ppt
Congestion Control and QOS.pptCongestion Control and QOS.ppt
Congestion Control and QOS.ppt
TamiratDejene1
 
Analog Transmission.ppt
Analog Transmission.pptAnalog Transmission.ppt
Analog Transmission.ppt
TamiratDejene1
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdf
TamiratDejene1
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdf
TamiratDejene1
 
00-intro-to-classes.pdf
00-intro-to-classes.pdf00-intro-to-classes.pdf
00-intro-to-classes.pdf
TamiratDejene1
 
DLD Chapter-5.pdf
DLD Chapter-5.pdfDLD Chapter-5.pdf
DLD Chapter-5.pdf
TamiratDejene1
 
DLD Chapter-4.pdf
DLD Chapter-4.pdfDLD Chapter-4.pdf
DLD Chapter-4.pdf
TamiratDejene1
 
DLD Chapter-2.pdf
DLD Chapter-2.pdfDLD Chapter-2.pdf
DLD Chapter-2.pdf
TamiratDejene1
 
DLD Chapter-1.pdf
DLD Chapter-1.pdfDLD Chapter-1.pdf
DLD Chapter-1.pdf
TamiratDejene1
 
DLD_Chapter_1.pdf
DLD_Chapter_1.pdfDLD_Chapter_1.pdf
DLD_Chapter_1.pdf
TamiratDejene1
 
Chapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfChapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdf
TamiratDejene1
 
Chapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfChapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdf
TamiratDejene1
 
Chapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfChapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdf
TamiratDejene1
 
Chapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfChapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdf
TamiratDejene1
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdf
TamiratDejene1
 
Chapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfChapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdf
TamiratDejene1
 

More from TamiratDejene1 (20)

Ch-3 lecture.pdf
Ch-3 lecture.pdfCh-3 lecture.pdf
Ch-3 lecture.pdf
 
Chapter 2.pptx
Chapter 2.pptxChapter 2.pptx
Chapter 2.pptx
 
Wireless LANs.ppt
Wireless LANs.pptWireless LANs.ppt
Wireless LANs.ppt
 
Data Link Control.ppt
Data Link Control.pptData Link Control.ppt
Data Link Control.ppt
 
Congestion Control and QOS.ppt
Congestion Control and QOS.pptCongestion Control and QOS.ppt
Congestion Control and QOS.ppt
 
Analog Transmission.ppt
Analog Transmission.pptAnalog Transmission.ppt
Analog Transmission.ppt
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdf
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdf
 
00-intro-to-classes.pdf
00-intro-to-classes.pdf00-intro-to-classes.pdf
00-intro-to-classes.pdf
 
DLD Chapter-5.pdf
DLD Chapter-5.pdfDLD Chapter-5.pdf
DLD Chapter-5.pdf
 
DLD Chapter-4.pdf
DLD Chapter-4.pdfDLD Chapter-4.pdf
DLD Chapter-4.pdf
 
DLD Chapter-2.pdf
DLD Chapter-2.pdfDLD Chapter-2.pdf
DLD Chapter-2.pdf
 
DLD Chapter-1.pdf
DLD Chapter-1.pdfDLD Chapter-1.pdf
DLD Chapter-1.pdf
 
DLD_Chapter_1.pdf
DLD_Chapter_1.pdfDLD_Chapter_1.pdf
DLD_Chapter_1.pdf
 
Chapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfChapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdf
 
Chapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfChapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdf
 
Chapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfChapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdf
 
Chapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfChapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdf
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdf
 
Chapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfChapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdf
 

Recently uploaded

一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
TravisMalana
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
Tabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsTabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflows
alex933524
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Subhajit Sahu
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
ewymefz
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
nscud
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
ukgaet
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
Business update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMIBusiness update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMI
AlejandraGmez176757
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
ArpitMalhotra16
 

Recently uploaded (20)

一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
Tabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsTabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflows
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
Business update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMIBusiness update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMI
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
 

Chapter – 4 Normalization and Relational Algebra.pdf

  • 2. Chapter 4: Normalization  Why Normalization: Anomalies  Functional Dependencies: Types  Steps of Normalization  Relational Algebra (Assignment)
  • 3. Normalization  After converting the ER diagram in to table forms, the next phase is implementing the process of normalization,  which is a collection of rules each table should satisfy.  Normalization is a series of steps followed to obtain a database design that allows for consistent storage and efficient access of data in a relational database.  These steps reduce data redundancy and the risk of data becoming inconsistent.
  • 4. …Normalization  One of the best ways to determine what information should be stored in a database is  to clarify what questions will be asked of it and  what data would be included in the answers  identifying the logical associations between data items and  designing a database that will represent such associations but without suffering 1. Insertion Anomalies 2. Deletion Anomalies 3. Modification Anomalies  Thus, the purpose of normalization is to reduce the chances for anomalies to occur in a database.
  • 5. Example of Anomalies on Unnormalized database table
  • 6. Anomalies  Deletion Anomalies  If employee with ID 16 is deleted then  every information about skill C++ and  the type of skill is deleted from the database.  Then we will not have any information about C++ and its skill type.  Insertion Anomalies  What if we have a new employee with a skill Pascal?  We cannot decide whether Pascal is allowed as a value for skill and  we have no clue about the type of skill that Pascal should be categorized as.  Modification Anomalies  if the address for Helico is changed from Piazza to Mexico?  We need to look for every occurrence of Helico School_Add from Piazza to Mexico,  which is prone to error.
  • 7. Functional Dependency (FD)  Before moving to the definition and application of normalization,  it is important to have an understanding of "functional dependency."  Data Dependency: The logical associations between data items that point the database designer in the direction of a good database design are referred to as determinant or dependent relationships.  Two data items A and B are said to be in a determinant or dependent relationship if certain values of data item B always appears with certain values of data item A
  • 8. Functional Dependency (FD)  if the existence of something, call it A, implies that B must exist and have a certain value, then we say that "B is functionally dependent on A."  We also often express this idea by saying that  "A determines B," or  "B is a function of A," or  "A functionally governs B.“  We ca express this as follows  "If A, then B."
  • 9. Functional Dependency (FD)  The notation is: A→B which is read as;  B is functionally dependent on A  In general, a functional dependency is a relationship among attributes. In relational databases, we can have a determinant that governs one other attribute or several other attributes. NB: FDs are derived from the real-world constraints on the attributes.
  • 10. Functional dependency example • Since both Wine type and Fork type are determined by the Dinner type, we say Wine is functionally dependent on Dinner and Fork is functionally dependent on Dinner. Dinner → Wine Dinner → Fork
  • 11. Types of dependency  Partial Dependency  If an attribute which is not a member of the primary key is dependent on some part of the primary key (if we have composite primary key) then that attribute is partially functionally dependent on the primary key.  Let {A,B} is the Primary Key and C is non key attribute.  Then if {A, B} →C and B→C or A→C  Then C is partially functionally dependent on {A, B}
  • 12. Types of dependency  Full Dependency  If an attribute which is not a member of the primary key is not dependent on some part of the primary key but the whole key (if we have composite primary key) then  that attribute is fully functionally dependent on the primary key.  Let {A, B} is the Primary Key and C is a non key attribute  Then if {A, B} →C and B→C and A→C  Then C Fully functionally dependent on {A, B}
  • 13. Types of dependency  Transitive Dependency  "If A implies B, and if also B implies C, then A implies C." Example:  If Mr X is a Human, and if every Human is an Animal, then Mr X must be an Animal.  Generalized way of describing transitive dependency is that: If A functionally governs B, AND If B functionally governs C THEN A functionally governs C  Provided that neither C nor B determines A i.e. (B /→ A and C /→ A)
  • 14. Types of dependency In the normal notation:  {(A→ B) AND (B→ C)} ==> A→C provided that  B /→ A and  C /→ A Steps of Normalization  We have various levels or steps in normalization called Normal Forms.  as we move from one lower level Normal Form to the higher  The level of complexity, strength of the rule and decomposition increases.  A table in a relational database is said to be in a certain normal form if it satisfies certain constraints.
  • 15. Steps in normalization  Un-Normalized Form:  Identify all data elements  First Normal Form:  Find the key with which you can find all data  Second Normal Form:  Remove part-key dependencies.  Make all data dependent on the whole key.  Third Normal Form  Remove non-key dependencies.  Make all data dependent on nothing but the key.  For most practical purposes, databases are considered normalized if they adhere to third normal form.
  • 16. First Normal Form (1NF)  Definition: a table (relation) is in 1NF If  There are no duplicated rows in the table. Unique identifier  Each cell is single-valued (i.e., there are no repeating groups).  Entries in a column (attribute, field) are of the same kind, i.e. the same domain or type.
  • 17. First Normal Form (1NF)  We have two ways of achieving atomicity:  Putting each repeating group into a separate table and connecting them with a primary key- foreign key relationship or  Moving these repeating groups to a new row by repeating the common attributes.  If so then find the key with which you can find all data
  • 19. First Normal Form (1NF)  In 1NF:  Remove all repeating groups.  Distribute the multi-valued attributes into different rows and  identify a unique identifier
  • 20. Second Normal Form (2NF)  Second Normal form 2NF  No partial dependency of a non-key attribute on part of the primary key.  This will result in a set of relations with a level of Second Normal Form.  Any table that is in 1NF and has a single-attribute (i.e., a non-composite) primary key is automatically in 2NF.  Definition: a table (relation) is in 2NF If It is in 1NF and If all non-key attributes are dependent on the entire primary key. i.e. no partial dependency.
  • 21. Second Normal Form (2NF)  Example for 2NF: • Business rule: Whenever an employee participates in a project, • he/she will be entitled for an incentive. • since we don’t have any repeating groups or attributes with multi- valued property. • This schema is in its 1NF
  • 22. Second Normal Form (2NF)  To convert it to a 2NF  we need to remove all partial dependencies of non-key attributes on part of the primary key.  {EmpID, ProjNo}→EmpName, ProjName, ProjLoc, ProjFund, ProjMangID, Incentive  But in addition to this we have the following dependencies  FD1: {EmpID} → EmpName  FD2: {ProjNo} → ProjName, ProjLoc, ProjFund, ProjMangID  FD3: {EmpID, ProjNo} → Incentive  As we can see,  some non-key attributes are partially dependent on some part of the primary key.  This can be witnessed by analyzing FD1 and FD2.
  • 23. Second Normal Form (2NF)  Thus, each Functional Dependencies, with their dependent attributes should be moved to a new relation where the Determinant will be the Primary Key for each.
  • 24. Third Normal Form (3NF)  Third Normal Form (3NF)  Eliminate Columns Dependent on another non- Primary Key  Definition: a Table (Relation) is in 3NF  If  It is in 2NF and  There are no transitive dependencies between a primary key and non-primary key attributes.  Example for (3NF)  Assumption: Students of same batch (same year) live in one building or dormitory
  • 25. • This schema is in its 2NF. • Let’s take StudID, Year and Dormitary and see the dependencies. StudID→ Year AND Year→ Dormitary And Year cannot determine StudID and Dormitary cannot determine StudID Then transitively StudID→ Dormitary • To convert it to a 3NF • we need to remove • all transitive dependencies i.e,. StudID→ Dormitary • The non-primary key attributes, dependent on each other i.e., Year→ Dormitary • will be moved to another table and linked with the main table using Candidate Key- Foreign Key relationship. Third Normal Form (3NF)
  • 26. • Generally, even though there are other four additional levels of Normalization, a table is said to be normalized if it reaches 3NF. • A database with all tables in the 3NF is said to be Normalized Database. • Normalization up to 3NF should hold the following: Third Normal Form (3NF)
  • 27. Other Examples on normalization  Consider this Example:
  • 28. Other Examples on normalization
  • 32. Other Examples on normalization  Generally we can have this
  • 33. 1)1. Given a relation R( A, B, C, D) and Functional Dependency set FD = { AB → CD, B → C }, determine whether the given R is in 2NF? If not convert it into 2 NF. 2)2.Given a relation R( P, Q, R, S, T) and Functional Dependency set FD = { PQ → R, S → T }, determine whether the given R is in 2NF? If not convert it into 2 NF. Exercise
  • 34. Questions1 Decomposed tables to be in 2NF includes as follows: a) R1( B, C) b) R2(A, B, D) Questions2: Decomposed tables to be in 2NF includes as follows: a) R1( P, Q, R) b) R2(S, T) c) R3(P, Q, S)
  • 35.  As we go to higher normal forms, we create a more number of relations.  Each higher normal form removes a certain type of dependency that causes redundancy.  As a relation becomes a higher normal form:  We have a more number of relations  That increases more number of joins in query forming  which increases more number of join processing  And also more referential integrity constraints need to be maintained  And thus schema is complicated and performance is decreased. So, many real-world DB designers stop at 3NF, which reasonably removes typical redundnacy and still maintains performance. So, strive to achieve 3NF in your real-world RDB! Normalization: Summary
  • 36.