SlideShare a Scribd company logo
1 of 26
Normalization
Oum Saokosal
Master's Degree in Information Systems, South
Korea
012-252-752 / 010-878-992
oumsaokosal@gmail.com
1
Normalization
 The biggest problem needed to be solved in database is
data redundancy.
 Why data redundancy is the problem? Because it causes:
 Insert Anomaly
 Update Anomaly
 Delete Anomaly
2
Teacher Subject Teacher Degree Tel
Sok San Database Master's 012666777
Van Sokhen Database Bachelor's 017678678
Sok San E-Commerce Master's 012666777
Normalization (Cont.)
 Normalization is the process of removing redundant data
from your tables to improve storage efficiency, data
integrity, and scalability.
 Normalization generally involves splitting existing tables
into multiple ones, which must be re-joined or linked
each time a query is issued.
 Why normalization?
 The relation derived from the user view or data store will most
likely be unnormalized.
 The problem usually happens when an existing system uses
unstructured file, e.g. in MS Excel.
3
Steps of Normalization
 First Normal Form (1NF)
 Second Normal Form (2NF)
 Third Normal Form (3NF)
 Boyce-Codd Normal Form (BCNF)
 Fourth Normal Form (4NF)
 Fifth Normal Form (5NF)
In practice, 1NF, 2NF, and 3NF are enough for database.
4
First Normal Form (1NF)
The official qualifications for 1NF are:
1. Each attribute name must be unique.
2. Each attribute value must be single.
3. Each row must be unique.
4. There is no repeating groups.
 Additional:
 Choose a primary key.
 Reminder:
A primary key is unique, not null, unchanged. A primary
key can be either an attribute or combined attributes.
5
First Normal Form (1NF) (Cont.)
 Example of a table not in 1NF :
It violates the 1NF because:
 Attribute values are not single.
 Repeating groups exists.
6
Group Topic Student Score
Group A Intro MongoDB Sok San 18 marks
Sao Ry 17 marks
Group B Intro MySQL Chan Tina 19 marks
Tith Sophea 16 marks
First Normal Form (1NF) (Cont.)
 After eliminating:
 Now it is in 1NF.
However, it might still violate 2NF and so on.
7
Group Topic Family Name Given Name Score
A Intro MongoDB Sok San 18
A Intro MongoDB Sao Ry 17
B Intro MySQL Chan Tina 19
B Intro MySQL Tith Sophea 16
Functional Dependencies
8
We say an attribute, B, has a functional dependency on another
attribute, A, if for any two records, which have
the same value for A, then the values for B in these two records
must be the same. We illustrate this as:
A  B (read as: A determines B or B depends on A)
employee name  email address
employee name project email address
Sok San POS Mart Sys soksan@yahoo.com
Sao Ry Univ Mgt Sys sao@yahoo.com
Sok San Web Redesign soksan@yahoo.com
Chan Sokna POS Mart Sys chan@gmail.com
Sao Ry DB Design sao@yahoo.com
Functional Dependencies (cont.)
9
EmpNum EmpEmail EmpFname EmpLname
123 jdoe@abc.com John Doe
456 psmith@abc.com Peter Smith
555 alee1@abc.com Alan Lee
633 pdoe@abc.com Peter Doe
787 alee2@abc.com Alan Lee
If EmpNum is the PK then the FDs:
EmpNum  EmpEmail, EmpFname, EmpLname
must exist.
Functional Dependencies (cont.)
10
EmpNum  EmpEmail, EmpFname, EmpLname
EmpNum
EmpEmail
EmpFname
EmpLname
EmpNum EmpEmail EmpFname EmpLname
3 different ways
you might see
FDs depicted
Determinant
11
Functional Dependency
EmpNum  EmpEmail
Attribute on the left hand side is known as the
determinant
• EmpNum is a determinant of EmpEmail
Second Normal Form (2NF)
The official qualifications for 2NF are:
1. A table is already in 1NF.
2. All nonkey attributes are fully dependent on the primary
key.
All partial dependencies are removed to place in another table.
12
CourseID SemesterID Num Student Course Name
IT101 201301 25 Database
IT101 201302 25 Database
IT102 201301 30 Web Prog
IT102 201302 35 Web Prog
IT103 201401 20 Networking
Example of a table not in 2NF:
Primary Key
The Course Name depends on only CourseID, a part of the primary key
not the whole primary {CourseID, SemesterID}.It’s called partial
dependency.
Solution:
Remove CourseID and Course Name together to create a new table.
13
CourseID Course Name
IT101 Database
IT101 Database
IT102 Web Prog
IT102 Web Prog
IT103 Networking
Semester
Done? Oh no, it is still
not in 1NF yet.
Remove the repeating
groups too.
Finally, connect the
relationship.
CourseID Course Name
IT101 Database
IT102 Web Prog
IT103 Networking
CourseID SemesterID Num Student
IT101 201301 25
IT101 201302 25
IT102 201301 30
IT102 201302 35
IT103 201401 20
14
Third Normal Form (3NF)
The official qualifications for 3NF are:
1. A table is already in 2NF.
2. Nonprimary key attributes do not depend on other
nonprimary key attributes
(i.e. no transitive dependencies)
All transitive dependencies are removed to place in
another table.
15
StudyID Course Name Teacher Name Teacher Tel
1 Database Sok Piseth 012 123 456
2 Database Sao Kanha 0977 322 111
3 Web Prog Chan Veasna 012 412 333
4 Web Prog Chan Veasna 012 412 333
5 Networking Pou Sambath 077 545 221
Example of a Table not in 3NF:
Primary Key
The Teacher Tel is a nonkey attribute, and
the Teacher Name is also a nonkey atttribute.
But Teacher Tel depends on Teacher Name.
It is called transitive dependency.
Solution:
Remove Teacher Name and Teacher Tel together
to create a new table.
16
Teacher Name Teacher Tel
Sok Piseth 012 123 456
Sao Kanha 0977 322 111
Chan Veasna 012 412 333
Chan Veasna 012 412 333
Pou Sambath 077 545 221
Done?
Oh no, it is still not in 1NF yet.
Remove Repeating row.
Teacher Name Teacher Tel
Sok Piseth 012 123 456
Sao Kanha 0977 322 111
Chan Veasna 012 412 333
Pou Sambath 077 545 221
Note about primary key:
-In theory, you can choose
Teacher Name to be a primary key.
-But in practice, you should add
Teacher ID as the primary key.
ID Teacher Name Teacher Tel
T1 Sok Piseth 012 123 456
T2 Sao Kanha 0977 322 111
T3 Chan Veasna 012 412 333
T4 Pou Sambath 077 545 221
StudyID Course Name T.ID
1 Database T1
2 Database T2
3 Web Prog T3
4 Web Prog T3
5 Networking T4
17
Boyce Codd Normal Form (BCNF) – 3.5NF
The official qualifications for BCNF are:
1. A table is already in 3NF.
2. All determinants must be superkeys.
All determinants that are not superkeys are removed to place in
another table.
18
Boyce Codd Normal Form (BCNF) (Cont.)
 Example of a table not in BCNF:
 Key: {Student, Course}
 Functional Dependency:
 {Student, Course} Teacher
 Teacher  Course
 Problem: Teacher is not a superkey but determines Course.
19
Student Course Teacher
Sok DB John
Sao DB William
Chan E-Commerce Todd
Sok E-Commerce Todd
Chan DB William
20
Student Course
Sok DB
Sao DB
Chan E-Commerce
Sok E-Commerce
Chan DB
Course Teacher
DB John
DB William
E-Commerce Todd
Course
DB
E-Commerce
Solution: Decouple a table
contains Teacher and Course
from from original table (Student,
Course). Finally, connect the new
and old table to third table
contains Course.
Forth Normal Form (4NF)
The official qualifications for 4NF are:
1. A table is already in BCNF.
2. A table contains no multi-valued dependencies.
 Multi-valued dependency: MVDs occur when two
or more independent multi valued facts about the
same attribute occur within the same table.
A  B (B multi-valued depends on A)
21
Forth Normal Form (4NF) (Cont.)
 Example of a table not in 4NF:
 Key: {Student, Major, Hobby}
 MVD: Student  Major, Hobby
22
Student Major Hobby
Sok IT Football
Sok IT Volleyball
Sao IT Football
Sao Med Football
Chan IT NULL
Puth NULL Football
Tith NULL NULL
23
Student Major
Sok IT
Sao IT
Sao Med
Chan IT
Puth NULL
Tith NULL
Student Hobby
Sok Football
Sok Volleyball
Sao Football
Chan NULL
Puth Football
Tith NULL
Student
Sok
Sao
Chan
Puth
Tith
Solution: Decouple to each
table contains MVD. Finally,
connect each to a third table
contains Student.
Fifth Normal Form (5NF)
The official qualifications for 5NF are:
1. A table is already in 4NF.
2. The attributes of multi-valued dependencies are related.
24
Fifth Normal Form (5NF) (Cont.)
 Example of a table not in 5NF:
 Key: {Seller, Company, Product}
 MVD: Seller  Company, Product
 Product is related to Company.
25
Seller Company Product
Sok MIAF Trading Zenya
Sao Coca-Cola Corp Coke
Sao Coca-Cola Corp Fanta
Sao Coca-Cola Corp Sprite
Chan Angkor Brewery Angkor Beer
Chan Cambodia Brewery Cambodia Beer
26
Seller Company
Sok MIAF Trading
Sao Coca-Cola Corp
Chan Angkor Brewery
Chan Cambodia Brewery
Seller Product
Sok Zenya
Sao Coke
Sao Fanta
Sao Sprite
Chan Angkor Beer
Chan Cambodia
Beer
Company Product
MIAF Trading Zenya
Coca-Cola Corp Coke
Coca-Cola Corp Fanta
Coca-Cola Corp Sprite
Angkor Brewery Angkor Beer
Cambodia
Brewery
Cambodia
Beer
Seller
Sok
Sao
Chan
Company
MIAF Trading
Coca-Cola Corp
Angkor Brewery
Cambodia Brewery
Product
Zenya
Coke
Fanta
Sprite
Angkor Beer
Cambodia Beer
1
1
1
1
1
1
M
M
M
M
M

More Related Content

What's hot

FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a DatabaseBishrul Haq
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joinsDeepthi Rachumallu
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Jargalsaikhan Alyeksandr
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra pptGirdharRatne
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management SystemKevin Jadiya
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQLrehaniltifat
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | EdurekaEdureka!
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 

What's hot (20)

FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
 
Linked lists
Linked listsLinked lists
Linked lists
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management System
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
joins in database
 joins in database joins in database
joins in database
 
Normal forms
Normal formsNormal forms
Normal forms
 
DBMS: Types of keys
DBMS:  Types of keysDBMS:  Types of keys
DBMS: Types of keys
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | Edureka
 
Normalization
NormalizationNormalization
Normalization
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 

Viewers also liked (11)

Normalization
NormalizationNormalization
Normalization
 
Contoh Kartu peserta ujian nasional
Contoh Kartu peserta ujian nasionalContoh Kartu peserta ujian nasional
Contoh Kartu peserta ujian nasional
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
 
Normalization
NormalizationNormalization
Normalization
 
Database Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal GulatiDatabase Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal Gulati
 
6 Materi Kuliah Normalisasi Tabel Database
6 Materi Kuliah Normalisasi Tabel Database6 Materi Kuliah Normalisasi Tabel Database
6 Materi Kuliah Normalisasi Tabel Database
 
Entity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationEntity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalization
 
A database design_report_for_college_library final
A database design_report_for_college_library finalA database design_report_for_college_library final
A database design_report_for_college_library final
 
Airlines Database Design
Airlines Database DesignAirlines Database Design
Airlines Database Design
 
DFM BIT Coursework
DFM BIT CourseworkDFM BIT Coursework
DFM BIT Coursework
 
DBMS - Normalization
DBMS - NormalizationDBMS - Normalization
DBMS - Normalization
 

Similar to Database normalization process

Normalization in Database Management System.pptx
Normalization in Database Management System.pptxNormalization in Database Management System.pptx
Normalization in Database Management System.pptxRoshni814224
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.pptDeependra35
 
CIS 111 STUDY Introduction Education--cis111study.com
CIS 111 STUDY Introduction Education--cis111study.comCIS 111 STUDY Introduction Education--cis111study.com
CIS 111 STUDY Introduction Education--cis111study.comclaric262
 
data Normalization.pdf
data Normalization.pdfdata Normalization.pdf
data Normalization.pdfBijayNag1
 
CIS 111 STUDY Knowledge Specialist--cis111study.com
CIS 111 STUDY Knowledge Specialist--cis111study.comCIS 111 STUDY Knowledge Specialist--cis111study.com
CIS 111 STUDY Knowledge Specialist--cis111study.comchrysanthemu86
 
CIS 111 STUDY Education Planning--cis111study.com
CIS 111 STUDY Education Planning--cis111study.comCIS 111 STUDY Education Planning--cis111study.com
CIS 111 STUDY Education Planning--cis111study.comagathachristie299
 
CIS 111 STUDY Education Counseling--cis111study.com
 CIS 111 STUDY Education Counseling--cis111study.com CIS 111 STUDY Education Counseling--cis111study.com
CIS 111 STUDY Education Counseling--cis111study.comshanaabe12
 
CIS 111 STUDY Education Your Life--cis111study
CIS 111 STUDY Education Your Life--cis111studyCIS 111 STUDY Education Your Life--cis111study
CIS 111 STUDY Education Your Life--cis111studythomashard44
 
CIS 111 STUDY Inspiring Innovation--cis111study.com
CIS 111 STUDY Inspiring Innovation--cis111study.comCIS 111 STUDY Inspiring Innovation--cis111study.com
CIS 111 STUDY Inspiring Innovation--cis111study.comKeatonJennings90
 
CIS 111 STUDY Achievement Education--cis111 study.com
CIS 111 STUDY Achievement Education--cis111 study.comCIS 111 STUDY Achievement Education--cis111 study.com
CIS 111 STUDY Achievement Education--cis111 study.comclaric153
 
CIS 111 STUDY Redefined Education--cis111study.com
CIS 111 STUDY Redefined Education--cis111study.comCIS 111 STUDY Redefined Education--cis111study.com
CIS 111 STUDY Redefined Education--cis111study.comclaric192
 
CIS 111 STUDY Become Exceptional--cis111study.com
CIS 111 STUDY Become Exceptional--cis111study.comCIS 111 STUDY Become Exceptional--cis111study.com
CIS 111 STUDY Become Exceptional--cis111study.comclaric102
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptxZoha681526
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptxkshipra sony
 
1683368767418684.pdf
1683368767418684.pdf1683368767418684.pdf
1683368767418684.pdfJanoakre
 
normalization of database management ppt
normalization of database management pptnormalization of database management ppt
normalization of database management pptRabiaKabir
 

Similar to Database normalization process (20)

Normalization in Database Management System.pptx
Normalization in Database Management System.pptxNormalization in Database Management System.pptx
Normalization in Database Management System.pptx
 
Chapter5.pptx
Chapter5.pptxChapter5.pptx
Chapter5.pptx
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
 
CIS 111 STUDY Introduction Education--cis111study.com
CIS 111 STUDY Introduction Education--cis111study.comCIS 111 STUDY Introduction Education--cis111study.com
CIS 111 STUDY Introduction Education--cis111study.com
 
data Normalization.pdf
data Normalization.pdfdata Normalization.pdf
data Normalization.pdf
 
CIS 111 STUDY Knowledge Specialist--cis111study.com
CIS 111 STUDY Knowledge Specialist--cis111study.comCIS 111 STUDY Knowledge Specialist--cis111study.com
CIS 111 STUDY Knowledge Specialist--cis111study.com
 
CIS 111 STUDY Education Planning--cis111study.com
CIS 111 STUDY Education Planning--cis111study.comCIS 111 STUDY Education Planning--cis111study.com
CIS 111 STUDY Education Planning--cis111study.com
 
CIS 111 STUDY Education Counseling--cis111study.com
 CIS 111 STUDY Education Counseling--cis111study.com CIS 111 STUDY Education Counseling--cis111study.com
CIS 111 STUDY Education Counseling--cis111study.com
 
CIS 111 STUDY Education Your Life--cis111study
CIS 111 STUDY Education Your Life--cis111studyCIS 111 STUDY Education Your Life--cis111study
CIS 111 STUDY Education Your Life--cis111study
 
CIS 111 STUDY Inspiring Innovation--cis111study.com
CIS 111 STUDY Inspiring Innovation--cis111study.comCIS 111 STUDY Inspiring Innovation--cis111study.com
CIS 111 STUDY Inspiring Innovation--cis111study.com
 
CIS 111 STUDY Achievement Education--cis111 study.com
CIS 111 STUDY Achievement Education--cis111 study.comCIS 111 STUDY Achievement Education--cis111 study.com
CIS 111 STUDY Achievement Education--cis111 study.com
 
CIS 111 STUDY Redefined Education--cis111study.com
CIS 111 STUDY Redefined Education--cis111study.comCIS 111 STUDY Redefined Education--cis111study.com
CIS 111 STUDY Redefined Education--cis111study.com
 
CIS 111 STUDY Become Exceptional--cis111study.com
CIS 111 STUDY Become Exceptional--cis111study.comCIS 111 STUDY Become Exceptional--cis111study.com
CIS 111 STUDY Become Exceptional--cis111study.com
 
Research gadot
Research gadotResearch gadot
Research gadot
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
 
Dbms record
Dbms recordDbms record
Dbms record
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
1683368767418684.pdf
1683368767418684.pdf1683368767418684.pdf
1683368767418684.pdf
 
normalization of database management ppt
normalization of database management pptnormalization of database management ppt
normalization of database management ppt
 

More from Oum Saokosal

Database Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS AccessDatabase Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS AccessOum Saokosal
 
Java Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract ClassJava Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract ClassOum Saokosal
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - PolymorphismOum Saokosal
 
Java Programming - Inheritance
Java Programming - InheritanceJava Programming - Inheritance
Java Programming - InheritanceOum Saokosal
 
Java Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceJava Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceOum Saokosal
 
Objected-Oriented Programming with Java
Objected-Oriented Programming with JavaObjected-Oriented Programming with Java
Objected-Oriented Programming with JavaOum Saokosal
 
12. Android Basic Google Map
12. Android Basic Google Map12. Android Basic Google Map
12. Android Basic Google MapOum Saokosal
 
11.1 Android with HTML
11.1 Android with HTML11.1 Android with HTML
11.1 Android with HTMLOum Saokosal
 
10.3 Android Video
10.3 Android Video10.3 Android Video
10.3 Android VideoOum Saokosal
 
10.2 Android Audio with SD Card
10.2 Android Audio with SD Card10.2 Android Audio with SD Card
10.2 Android Audio with SD CardOum Saokosal
 
10.1. Android Audio
10.1. Android Audio10.1. Android Audio
10.1. Android AudioOum Saokosal
 
09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)Oum Saokosal
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)Oum Saokosal
 
07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)Oum Saokosal
 
07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto CompleteOum Saokosal
 
07.1. Android Even Handling
07.1. Android Even Handling07.1. Android Even Handling
07.1. Android Even HandlingOum Saokosal
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and ContainerOum Saokosal
 
More on Application Structure
More on Application StructureMore on Application Structure
More on Application StructureOum Saokosal
 
04. Review OOP with Java
04. Review OOP with Java04. Review OOP with Java
04. Review OOP with JavaOum Saokosal
 
Basic Understanding of Android XML
Basic Understanding of Android XMLBasic Understanding of Android XML
Basic Understanding of Android XMLOum Saokosal
 

More from Oum Saokosal (20)

Database Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS AccessDatabase Concept - ERD Mapping to MS Access
Database Concept - ERD Mapping to MS Access
 
Java Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract ClassJava Programming - Introduction to Abstract Class
Java Programming - Introduction to Abstract Class
 
Java Programming - Polymorphism
Java Programming - PolymorphismJava Programming - Polymorphism
Java Programming - Polymorphism
 
Java Programming - Inheritance
Java Programming - InheritanceJava Programming - Inheritance
Java Programming - Inheritance
 
Java Programming - Abstract Class and Interface
Java Programming - Abstract Class and InterfaceJava Programming - Abstract Class and Interface
Java Programming - Abstract Class and Interface
 
Objected-Oriented Programming with Java
Objected-Oriented Programming with JavaObjected-Oriented Programming with Java
Objected-Oriented Programming with Java
 
12. Android Basic Google Map
12. Android Basic Google Map12. Android Basic Google Map
12. Android Basic Google Map
 
11.1 Android with HTML
11.1 Android with HTML11.1 Android with HTML
11.1 Android with HTML
 
10.3 Android Video
10.3 Android Video10.3 Android Video
10.3 Android Video
 
10.2 Android Audio with SD Card
10.2 Android Audio with SD Card10.2 Android Audio with SD Card
10.2 Android Audio with SD Card
 
10.1. Android Audio
10.1. Android Audio10.1. Android Audio
10.1. Android Audio
 
09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)09.1. Android - Local Database (Sqlite)
09.1. Android - Local Database (Sqlite)
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)
 
07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)07.4. Android Basic Simple Browser (WebView)
07.4. Android Basic Simple Browser (WebView)
 
07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete07.3. Android Alert message, List, Dropdown, and Auto Complete
07.3. Android Alert message, List, Dropdown, and Auto Complete
 
07.1. Android Even Handling
07.1. Android Even Handling07.1. Android Even Handling
07.1. Android Even Handling
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
 
More on Application Structure
More on Application StructureMore on Application Structure
More on Application Structure
 
04. Review OOP with Java
04. Review OOP with Java04. Review OOP with Java
04. Review OOP with Java
 
Basic Understanding of Android XML
Basic Understanding of Android XMLBasic Understanding of Android XML
Basic Understanding of Android XML
 

Recently uploaded

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

Database normalization process

  • 1. Normalization Oum Saokosal Master's Degree in Information Systems, South Korea 012-252-752 / 010-878-992 oumsaokosal@gmail.com 1
  • 2. Normalization  The biggest problem needed to be solved in database is data redundancy.  Why data redundancy is the problem? Because it causes:  Insert Anomaly  Update Anomaly  Delete Anomaly 2 Teacher Subject Teacher Degree Tel Sok San Database Master's 012666777 Van Sokhen Database Bachelor's 017678678 Sok San E-Commerce Master's 012666777
  • 3. Normalization (Cont.)  Normalization is the process of removing redundant data from your tables to improve storage efficiency, data integrity, and scalability.  Normalization generally involves splitting existing tables into multiple ones, which must be re-joined or linked each time a query is issued.  Why normalization?  The relation derived from the user view or data store will most likely be unnormalized.  The problem usually happens when an existing system uses unstructured file, e.g. in MS Excel. 3
  • 4. Steps of Normalization  First Normal Form (1NF)  Second Normal Form (2NF)  Third Normal Form (3NF)  Boyce-Codd Normal Form (BCNF)  Fourth Normal Form (4NF)  Fifth Normal Form (5NF) In practice, 1NF, 2NF, and 3NF are enough for database. 4
  • 5. First Normal Form (1NF) The official qualifications for 1NF are: 1. Each attribute name must be unique. 2. Each attribute value must be single. 3. Each row must be unique. 4. There is no repeating groups.  Additional:  Choose a primary key.  Reminder: A primary key is unique, not null, unchanged. A primary key can be either an attribute or combined attributes. 5
  • 6. First Normal Form (1NF) (Cont.)  Example of a table not in 1NF : It violates the 1NF because:  Attribute values are not single.  Repeating groups exists. 6 Group Topic Student Score Group A Intro MongoDB Sok San 18 marks Sao Ry 17 marks Group B Intro MySQL Chan Tina 19 marks Tith Sophea 16 marks
  • 7. First Normal Form (1NF) (Cont.)  After eliminating:  Now it is in 1NF. However, it might still violate 2NF and so on. 7 Group Topic Family Name Given Name Score A Intro MongoDB Sok San 18 A Intro MongoDB Sao Ry 17 B Intro MySQL Chan Tina 19 B Intro MySQL Tith Sophea 16
  • 8. Functional Dependencies 8 We say an attribute, B, has a functional dependency on another attribute, A, if for any two records, which have the same value for A, then the values for B in these two records must be the same. We illustrate this as: A  B (read as: A determines B or B depends on A) employee name  email address employee name project email address Sok San POS Mart Sys soksan@yahoo.com Sao Ry Univ Mgt Sys sao@yahoo.com Sok San Web Redesign soksan@yahoo.com Chan Sokna POS Mart Sys chan@gmail.com Sao Ry DB Design sao@yahoo.com
  • 9. Functional Dependencies (cont.) 9 EmpNum EmpEmail EmpFname EmpLname 123 jdoe@abc.com John Doe 456 psmith@abc.com Peter Smith 555 alee1@abc.com Alan Lee 633 pdoe@abc.com Peter Doe 787 alee2@abc.com Alan Lee If EmpNum is the PK then the FDs: EmpNum  EmpEmail, EmpFname, EmpLname must exist.
  • 10. Functional Dependencies (cont.) 10 EmpNum  EmpEmail, EmpFname, EmpLname EmpNum EmpEmail EmpFname EmpLname EmpNum EmpEmail EmpFname EmpLname 3 different ways you might see FDs depicted
  • 11. Determinant 11 Functional Dependency EmpNum  EmpEmail Attribute on the left hand side is known as the determinant • EmpNum is a determinant of EmpEmail
  • 12. Second Normal Form (2NF) The official qualifications for 2NF are: 1. A table is already in 1NF. 2. All nonkey attributes are fully dependent on the primary key. All partial dependencies are removed to place in another table. 12
  • 13. CourseID SemesterID Num Student Course Name IT101 201301 25 Database IT101 201302 25 Database IT102 201301 30 Web Prog IT102 201302 35 Web Prog IT103 201401 20 Networking Example of a table not in 2NF: Primary Key The Course Name depends on only CourseID, a part of the primary key not the whole primary {CourseID, SemesterID}.It’s called partial dependency. Solution: Remove CourseID and Course Name together to create a new table. 13
  • 14. CourseID Course Name IT101 Database IT101 Database IT102 Web Prog IT102 Web Prog IT103 Networking Semester Done? Oh no, it is still not in 1NF yet. Remove the repeating groups too. Finally, connect the relationship. CourseID Course Name IT101 Database IT102 Web Prog IT103 Networking CourseID SemesterID Num Student IT101 201301 25 IT101 201302 25 IT102 201301 30 IT102 201302 35 IT103 201401 20 14
  • 15. Third Normal Form (3NF) The official qualifications for 3NF are: 1. A table is already in 2NF. 2. Nonprimary key attributes do not depend on other nonprimary key attributes (i.e. no transitive dependencies) All transitive dependencies are removed to place in another table. 15
  • 16. StudyID Course Name Teacher Name Teacher Tel 1 Database Sok Piseth 012 123 456 2 Database Sao Kanha 0977 322 111 3 Web Prog Chan Veasna 012 412 333 4 Web Prog Chan Veasna 012 412 333 5 Networking Pou Sambath 077 545 221 Example of a Table not in 3NF: Primary Key The Teacher Tel is a nonkey attribute, and the Teacher Name is also a nonkey atttribute. But Teacher Tel depends on Teacher Name. It is called transitive dependency. Solution: Remove Teacher Name and Teacher Tel together to create a new table. 16
  • 17. Teacher Name Teacher Tel Sok Piseth 012 123 456 Sao Kanha 0977 322 111 Chan Veasna 012 412 333 Chan Veasna 012 412 333 Pou Sambath 077 545 221 Done? Oh no, it is still not in 1NF yet. Remove Repeating row. Teacher Name Teacher Tel Sok Piseth 012 123 456 Sao Kanha 0977 322 111 Chan Veasna 012 412 333 Pou Sambath 077 545 221 Note about primary key: -In theory, you can choose Teacher Name to be a primary key. -But in practice, you should add Teacher ID as the primary key. ID Teacher Name Teacher Tel T1 Sok Piseth 012 123 456 T2 Sao Kanha 0977 322 111 T3 Chan Veasna 012 412 333 T4 Pou Sambath 077 545 221 StudyID Course Name T.ID 1 Database T1 2 Database T2 3 Web Prog T3 4 Web Prog T3 5 Networking T4 17
  • 18. Boyce Codd Normal Form (BCNF) – 3.5NF The official qualifications for BCNF are: 1. A table is already in 3NF. 2. All determinants must be superkeys. All determinants that are not superkeys are removed to place in another table. 18
  • 19. Boyce Codd Normal Form (BCNF) (Cont.)  Example of a table not in BCNF:  Key: {Student, Course}  Functional Dependency:  {Student, Course} Teacher  Teacher  Course  Problem: Teacher is not a superkey but determines Course. 19 Student Course Teacher Sok DB John Sao DB William Chan E-Commerce Todd Sok E-Commerce Todd Chan DB William
  • 20. 20 Student Course Sok DB Sao DB Chan E-Commerce Sok E-Commerce Chan DB Course Teacher DB John DB William E-Commerce Todd Course DB E-Commerce Solution: Decouple a table contains Teacher and Course from from original table (Student, Course). Finally, connect the new and old table to third table contains Course.
  • 21. Forth Normal Form (4NF) The official qualifications for 4NF are: 1. A table is already in BCNF. 2. A table contains no multi-valued dependencies.  Multi-valued dependency: MVDs occur when two or more independent multi valued facts about the same attribute occur within the same table. A  B (B multi-valued depends on A) 21
  • 22. Forth Normal Form (4NF) (Cont.)  Example of a table not in 4NF:  Key: {Student, Major, Hobby}  MVD: Student  Major, Hobby 22 Student Major Hobby Sok IT Football Sok IT Volleyball Sao IT Football Sao Med Football Chan IT NULL Puth NULL Football Tith NULL NULL
  • 23. 23 Student Major Sok IT Sao IT Sao Med Chan IT Puth NULL Tith NULL Student Hobby Sok Football Sok Volleyball Sao Football Chan NULL Puth Football Tith NULL Student Sok Sao Chan Puth Tith Solution: Decouple to each table contains MVD. Finally, connect each to a third table contains Student.
  • 24. Fifth Normal Form (5NF) The official qualifications for 5NF are: 1. A table is already in 4NF. 2. The attributes of multi-valued dependencies are related. 24
  • 25. Fifth Normal Form (5NF) (Cont.)  Example of a table not in 5NF:  Key: {Seller, Company, Product}  MVD: Seller  Company, Product  Product is related to Company. 25 Seller Company Product Sok MIAF Trading Zenya Sao Coca-Cola Corp Coke Sao Coca-Cola Corp Fanta Sao Coca-Cola Corp Sprite Chan Angkor Brewery Angkor Beer Chan Cambodia Brewery Cambodia Beer
  • 26. 26 Seller Company Sok MIAF Trading Sao Coca-Cola Corp Chan Angkor Brewery Chan Cambodia Brewery Seller Product Sok Zenya Sao Coke Sao Fanta Sao Sprite Chan Angkor Beer Chan Cambodia Beer Company Product MIAF Trading Zenya Coca-Cola Corp Coke Coca-Cola Corp Fanta Coca-Cola Corp Sprite Angkor Brewery Angkor Beer Cambodia Brewery Cambodia Beer Seller Sok Sao Chan Company MIAF Trading Coca-Cola Corp Angkor Brewery Cambodia Brewery Product Zenya Coke Fanta Sprite Angkor Beer Cambodia Beer 1 1 1 1 1 1 M M M M M