SlideShare a Scribd company logo
1 of 18
Normalization
Database Normalization
Database normalization is the process of removing
redundant data from your tables in to improve storage
efficiency, data integrity, and scalability.
In the relational model, methods exist for quantifying how
efficient a database is. These classifications are called
normal forms (or NF), and there are algorithms for
converting a given database between them.
Normalization generally involves splitting existing tables
into multiple ones, which must be re-joined or linked each
time a query is issued.
History
Edgar F. Codd first proposed the process of
normalization and what came to be known as the
1st normal form in his paper A Relational Model
of Data for Large Shared Data Banks Codd stated:
“There is, in fact, a very simple elimination
procedure which we shall call normalization.
Through decomposition nonsimple domains are
replaced by ‘domains whose elements are atomic
(nondecomposable) values.’”
Normal Form
Edgar F. Codd originally established three normal
forms: 1NF, 2NF and 3NF. There are now others that
are generally accepted, but 3NF is widely considered
to be sufficient for most applications. Most tables
when reaching 3NF are also in BCNF (Boyce-Codd
Normal Form).
Table 1
TitleTitle Author1Author1 AuthorAuthor
22
ISBNISBN SubjectSubject PagesPages PublisherPublisher
DatabaseDatabase
SystemSystem
ConceptsConcepts
AbrahamAbraham
SilberschatzSilberschatz
HenryHenry
F. KorthF. Korth
00729588630072958863 MySQL,MySQL,
ComputersComputers
11681168 McGraw-HillMcGraw-Hill
OperatingOperating
SystemSystem
ConceptsConcepts
AbrahamAbraham
SilberschatzSilberschatz
HenryHenry
F. KorthF. Korth
04716946650471694665 ComputersComputers 944944 McGraw-HillMcGraw-Hill
Table 1 problems
This table is not very efficient with storage.
This design does not protect data integrity.
Third, this table does not scale well.
First Normal Form
In our Table 1, we have two violations of First Normal
Form:
First, we have more than one author field,
Second, our subject field contains more than one
piece of information. With more than one value in a
single field, it would be very difficult to search for all
books on a given subject.
First Normal Table
Table 2
TitleTitle AuthorAuthor ISBNISBN SubjectSubject PagesPages PublisherPublisher
Database SystemDatabase System
ConceptsConcepts
AbrahamAbraham
SilberschatzSilberschatz
00729588630072958863 MySQLMySQL 11681168 McGraw-HillMcGraw-Hill
Database SystemDatabase System
ConceptsConcepts
Henry F. KorthHenry F. Korth 00729588630072958863 ComputersComputers 11681168 McGraw-HillMcGraw-Hill
Operating SystemOperating System
ConceptsConcepts
Henry F. KorthHenry F. Korth 04716946650471694665 ComputersComputers 944944 McGraw-HillMcGraw-Hill
Operating SystemOperating System
ConceptsConcepts
AbrahamAbraham
SilberschatzSilberschatz
04716946650471694665 ComputersComputers 944944 McGraw-HillMcGraw-Hill
We now have two rows for a single book.
Additionally, we would be violating the Second
Normal Form…
A better solution to our problem would be to separate
the data into separate tables- an Author table and a
Subject table to store our information, removing that
information from the Book table:
Subject_IDSubject_ID SubjectSubject
11 MySQLMySQL
22 ComputersComputers
Author_IDAuthor_ID Last NameLast Name First NameFirst Name
11 SilberschatzSilberschatz AbrahamAbraham
22 KorthKorth HenryHenry
ISBNISBN TitleTitle PagesPages PublisherPublisher
00729588630072958863 Database SystemDatabase System
ConceptsConcepts
11681168 McGraw-HillMcGraw-Hill
04716946650471694665 Operating SystemOperating System
ConceptsConcepts
944944 McGraw-HillMcGraw-Hill
Subject Table
Author Table
Book Table
Each table has a primary key, used for joining tables
together when querying the data. A primary key value
must be unique with in the table (no two books can
have the same ISBN number), and a primary key is
also an index, which speeds up data retrieval based on
the primary key.
Now to define relationships between the tables
Relationships
ISBNISBN Author_IDAuthor_ID
00729588630072958863 11
00729588630072958863 22
04716946650471694665 11
04716946650471694665 22
ISBNISBN Subject_IDSubject_ID
00729588630072958863 11
00729588630072958863 22
04716946650471694665 22
Book_Author Table
Book_Subject Table
Second Normal Form
As the First Normal Form deals with redundancy
of data across a horizontal row, Second Normal
Form (or 2NF) deals with redundancy of data in
vertical columns.
As stated earlier, the normal forms are
progressive, so to achieve Second Normal Form,
the tables must already be in First Normal Form.
The Book Table will be used for the 2NF example
2NF Table
Publisher_IDPublisher_ID Publisher NamePublisher Name
11 McGraw-HillMcGraw-Hill
ISBNISBN TitleTitle PagesPages Publisher_IDPublisher_ID
00729588630072958863 Database SystemDatabase System
ConceptsConcepts
11681168 11
04716946650471694665 Operating SystemOperating System
ConceptsConcepts
944944 11
Publisher Table
Book Table
2NF
Here we have a one-to-many relationship
between the book table and the publisher. A book
has only one publisher, and a publisher will
publish many books. When we have a one-to-
many relationship, we place a foreign key in the
Book Table, pointing to the primary key of the
Publisher Table.
The other requirement for Second Normal Form
is that you cannot have any data in a table with a
composite key that does not relate to all portions
of the composite key.
Third Normal Form
Third normal form (3NF) requires that there are no
functional dependencies of non-key attributes on
something other than a candidate key.
A table is in 3NF if all of the non-primary key
attributes are mutually independent
There should not be transitive dependencies
Boyce-Codd Normal Form
BCNF requires that the table is 3NF and only
determinants are the candidate keys
THANK YOU

More Related Content

What's hot

Chapter 8: tree data structure
Chapter 8:  tree data structureChapter 8:  tree data structure
Chapter 8: tree data structureMahmoud Alfarra
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceTransweb Global Inc
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithmsVinayKumarV16
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Hassan Ahmed
 
Introduction of Data Structure
Introduction of Data StructureIntroduction of Data Structure
Introduction of Data StructureMandavi Classes
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data StructureA. N. M. Jubaer
 
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARIntroduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARBHARATH KUMAR
 
Genomic Selection with Bayesian Generalized Linear Regression model using R
Genomic Selection with Bayesian Generalized Linear Regression model using RGenomic Selection with Bayesian Generalized Linear Regression model using R
Genomic Selection with Bayesian Generalized Linear Regression model using RAvjinder (Avi) Kaler
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueGhaffar Khan
 
SQL Joins and Query Optimization
SQL Joins and Query OptimizationSQL Joins and Query Optimization
SQL Joins and Query OptimizationBrian Gallagher
 
Oracle interview questions
Oracle interview questionsOracle interview questions
Oracle interview questionsbarbie0909
 
Basic Tutorial of Association Mapping by Avjinder Kaler
Basic Tutorial of Association Mapping by Avjinder KalerBasic Tutorial of Association Mapping by Avjinder Kaler
Basic Tutorial of Association Mapping by Avjinder KalerAvjinder (Avi) Kaler
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its typesNavtar Sidhu Brar
 
Data structure
Data structureData structure
Data structureMohd Arif
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structuresDurgaDeviCbit
 

What's hot (20)

Chapter 8: tree data structure
Chapter 8:  tree data structureChapter 8:  tree data structure
Chapter 8: tree data structure
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithms
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
 
Introduction of Data Structure
Introduction of Data StructureIntroduction of Data Structure
Introduction of Data Structure
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
 
Data Structures
Data StructuresData Structures
Data Structures
 
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARIntroduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
 
Genomic Selection with Bayesian Generalized Linear Regression model using R
Genomic Selection with Bayesian Generalized Linear Regression model using RGenomic Selection with Bayesian Generalized Linear Regression model using R
Genomic Selection with Bayesian Generalized Linear Regression model using R
 
Lists
ListsLists
Lists
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
 
Linked Lists
Linked ListsLinked Lists
Linked Lists
 
Linked list
Linked listLinked list
Linked list
 
SQL Joins and Query Optimization
SQL Joins and Query OptimizationSQL Joins and Query Optimization
SQL Joins and Query Optimization
 
Oracle interview questions
Oracle interview questionsOracle interview questions
Oracle interview questions
 
Basic Tutorial of Association Mapping by Avjinder Kaler
Basic Tutorial of Association Mapping by Avjinder KalerBasic Tutorial of Association Mapping by Avjinder Kaler
Basic Tutorial of Association Mapping by Avjinder Kaler
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
What is data structure
What is data structureWhat is data structure
What is data structure
 
Data structure
Data structureData structure
Data structure
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
 

Viewers also liked

BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database ModelsPrithwis Mukerjee
 
Bitcoin, Blockchain and the Crypto Contracts - Part 2
Bitcoin, Blockchain and the Crypto Contracts - Part 2Bitcoin, Blockchain and the Crypto Contracts - Part 2
Bitcoin, Blockchain and the Crypto Contracts - Part 2Prithwis Mukerjee
 
Datawarehousing and Business Intelligence
Datawarehousing and Business IntelligenceDatawarehousing and Business Intelligence
Datawarehousing and Business IntelligencePrithwis Mukerjee
 

Viewers also liked (7)

BIS04 Data Modelling - II
BIS04 Data Modelling  - IIBIS04 Data Modelling  - II
BIS04 Data Modelling - II
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database Models
 
BIS03 Data Modelling - I
BIS03 Data Modelling - IBIS03 Data Modelling - I
BIS03 Data Modelling - I
 
Data Science
Data ScienceData Science
Data Science
 
OeO_Web2.0._Pavelic
OeO_Web2.0._PavelicOeO_Web2.0._Pavelic
OeO_Web2.0._Pavelic
 
Bitcoin, Blockchain and the Crypto Contracts - Part 2
Bitcoin, Blockchain and the Crypto Contracts - Part 2Bitcoin, Blockchain and the Crypto Contracts - Part 2
Bitcoin, Blockchain and the Crypto Contracts - Part 2
 
Datawarehousing and Business Intelligence
Datawarehousing and Business IntelligenceDatawarehousing and Business Intelligence
Datawarehousing and Business Intelligence
 

Similar to Normalization

Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATIONbit allahabad
 
Normalization Accepted
Normalization AcceptedNormalization Accepted
Normalization Acceptedprasaddurga
 
Normalization
NormalizationNormalization
Normalizationlingesan
 
Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016Dave Stokes
 
SQL For Programmers -- Boston Big Data Techcon April 27th
SQL For Programmers -- Boston Big Data Techcon April 27thSQL For Programmers -- Boston Big Data Techcon April 27th
SQL For Programmers -- Boston Big Data Techcon April 27thDave Stokes
 
denormalization.ppt
denormalization.pptdenormalization.ppt
denormalization.pptABUSUFYAN55
 
NoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to CouchbaseNoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to CouchbaseMohammad Shaker
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesUlf Wendel
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introductiondinkar thakur
 
Data Bases - Introduction to data science
Data Bases - Introduction to data scienceData Bases - Introduction to data science
Data Bases - Introduction to data scienceFrank Kienle
 

Similar to Normalization (20)

Database Normalization.pptx
Database Normalization.pptxDatabase Normalization.pptx
Database Normalization.pptx
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
 
Normalization Accepted
Normalization AcceptedNormalization Accepted
Normalization Accepted
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016Relational Theory for Budding Einsteins -- LonestarPHP 2016
Relational Theory for Budding Einsteins -- LonestarPHP 2016
 
normaliztion
normaliztionnormaliztion
normaliztion
 
SQL For Programmers -- Boston Big Data Techcon April 27th
SQL For Programmers -- Boston Big Data Techcon April 27thSQL For Programmers -- Boston Big Data Techcon April 27th
SQL For Programmers -- Boston Big Data Techcon April 27th
 
D B M S Animate
D B M S AnimateD B M S Animate
D B M S Animate
 
denormalization.ppt
denormalization.pptdenormalization.ppt
denormalization.ppt
 
NoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to CouchbaseNoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to Couchbase
 
Exception & Database
Exception & DatabaseException & Database
Exception & Database
 
Final exam in advance dbms
Final exam in advance dbmsFinal exam in advance dbms
Final exam in advance dbms
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
Database Management & Models
Database Management & ModelsDatabase Management & Models
Database Management & Models
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodes
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
disertation
disertationdisertation
disertation
 
Data Bases - Introduction to data science
Data Bases - Introduction to data scienceData Bases - Introduction to data science
Data Bases - Introduction to data science
 

Normalization

  • 2. Database Normalization Database normalization is the process of removing redundant data from your tables in to improve storage efficiency, data integrity, and scalability. In the relational model, methods exist for quantifying how efficient a database is. These classifications are called normal forms (or NF), and there are algorithms for converting a given database between them. Normalization generally involves splitting existing tables into multiple ones, which must be re-joined or linked each time a query is issued.
  • 3. History Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form in his paper A Relational Model of Data for Large Shared Data Banks Codd stated: “There is, in fact, a very simple elimination procedure which we shall call normalization. Through decomposition nonsimple domains are replaced by ‘domains whose elements are atomic (nondecomposable) values.’”
  • 4. Normal Form Edgar F. Codd originally established three normal forms: 1NF, 2NF and 3NF. There are now others that are generally accepted, but 3NF is widely considered to be sufficient for most applications. Most tables when reaching 3NF are also in BCNF (Boyce-Codd Normal Form).
  • 5. Table 1 TitleTitle Author1Author1 AuthorAuthor 22 ISBNISBN SubjectSubject PagesPages PublisherPublisher DatabaseDatabase SystemSystem ConceptsConcepts AbrahamAbraham SilberschatzSilberschatz HenryHenry F. KorthF. Korth 00729588630072958863 MySQL,MySQL, ComputersComputers 11681168 McGraw-HillMcGraw-Hill OperatingOperating SystemSystem ConceptsConcepts AbrahamAbraham SilberschatzSilberschatz HenryHenry F. KorthF. Korth 04716946650471694665 ComputersComputers 944944 McGraw-HillMcGraw-Hill
  • 6. Table 1 problems This table is not very efficient with storage. This design does not protect data integrity. Third, this table does not scale well.
  • 7. First Normal Form In our Table 1, we have two violations of First Normal Form: First, we have more than one author field, Second, our subject field contains more than one piece of information. With more than one value in a single field, it would be very difficult to search for all books on a given subject.
  • 8. First Normal Table Table 2 TitleTitle AuthorAuthor ISBNISBN SubjectSubject PagesPages PublisherPublisher Database SystemDatabase System ConceptsConcepts AbrahamAbraham SilberschatzSilberschatz 00729588630072958863 MySQLMySQL 11681168 McGraw-HillMcGraw-Hill Database SystemDatabase System ConceptsConcepts Henry F. KorthHenry F. Korth 00729588630072958863 ComputersComputers 11681168 McGraw-HillMcGraw-Hill Operating SystemOperating System ConceptsConcepts Henry F. KorthHenry F. Korth 04716946650471694665 ComputersComputers 944944 McGraw-HillMcGraw-Hill Operating SystemOperating System ConceptsConcepts AbrahamAbraham SilberschatzSilberschatz 04716946650471694665 ComputersComputers 944944 McGraw-HillMcGraw-Hill
  • 9. We now have two rows for a single book. Additionally, we would be violating the Second Normal Form… A better solution to our problem would be to separate the data into separate tables- an Author table and a Subject table to store our information, removing that information from the Book table:
  • 10. Subject_IDSubject_ID SubjectSubject 11 MySQLMySQL 22 ComputersComputers Author_IDAuthor_ID Last NameLast Name First NameFirst Name 11 SilberschatzSilberschatz AbrahamAbraham 22 KorthKorth HenryHenry ISBNISBN TitleTitle PagesPages PublisherPublisher 00729588630072958863 Database SystemDatabase System ConceptsConcepts 11681168 McGraw-HillMcGraw-Hill 04716946650471694665 Operating SystemOperating System ConceptsConcepts 944944 McGraw-HillMcGraw-Hill Subject Table Author Table Book Table
  • 11. Each table has a primary key, used for joining tables together when querying the data. A primary key value must be unique with in the table (no two books can have the same ISBN number), and a primary key is also an index, which speeds up data retrieval based on the primary key. Now to define relationships between the tables
  • 12. Relationships ISBNISBN Author_IDAuthor_ID 00729588630072958863 11 00729588630072958863 22 04716946650471694665 11 04716946650471694665 22 ISBNISBN Subject_IDSubject_ID 00729588630072958863 11 00729588630072958863 22 04716946650471694665 22 Book_Author Table Book_Subject Table
  • 13. Second Normal Form As the First Normal Form deals with redundancy of data across a horizontal row, Second Normal Form (or 2NF) deals with redundancy of data in vertical columns. As stated earlier, the normal forms are progressive, so to achieve Second Normal Form, the tables must already be in First Normal Form. The Book Table will be used for the 2NF example
  • 14. 2NF Table Publisher_IDPublisher_ID Publisher NamePublisher Name 11 McGraw-HillMcGraw-Hill ISBNISBN TitleTitle PagesPages Publisher_IDPublisher_ID 00729588630072958863 Database SystemDatabase System ConceptsConcepts 11681168 11 04716946650471694665 Operating SystemOperating System ConceptsConcepts 944944 11 Publisher Table Book Table
  • 15. 2NF Here we have a one-to-many relationship between the book table and the publisher. A book has only one publisher, and a publisher will publish many books. When we have a one-to- many relationship, we place a foreign key in the Book Table, pointing to the primary key of the Publisher Table. The other requirement for Second Normal Form is that you cannot have any data in a table with a composite key that does not relate to all portions of the composite key.
  • 16. Third Normal Form Third normal form (3NF) requires that there are no functional dependencies of non-key attributes on something other than a candidate key. A table is in 3NF if all of the non-primary key attributes are mutually independent There should not be transitive dependencies
  • 17. Boyce-Codd Normal Form BCNF requires that the table is 3NF and only determinants are the candidate keys