HARAMBEE UNIVERSITY
Model Data Objects
LO2:
Develop normalization
1.1 Undertaking normalization of business data and Documenting results
Normalization
➢ Database Normalization is a technique of organizing the data in the database.
➢ It is a technique that reduces data redundancy and eliminates undesirable
characteristics like Insertion, Update and Deletion Anomalies.
➢ Normalization rules divides larger tables into smaller tables and links them
using relationships.
➢ The purpose of normalization in SQL is to eliminate redundant (repetitive)
data and ensure data is stored logically.
The purpose of Normalization
⁕ Normalization is used for mainly two purposes:
✓ Eliminating or reducing redundant data.
✓ Ensuring data dependencies make sense i.e., data is logically stored.
Normalization
A process of organizing data in database.
1. Create Tables
2. Established relationship between created tables
3. Eliminate data redundancy
Types of normal forms
1. First normal form (1NF)
2. Second normal form (2NF)
3. Third normal form (3NF)
4. Boyce & Codd normal form (BCNF)
5. Fourth normal form (4NF)
6. Fifth normal form (5NF)
1NF rules:
• A relation will be 1NF if it contains an atomic value.
• A table cannot hold multiple values.
• It must hold only single-valued attribute.
• It disallows the multi-valued attribute, composite attribute, and their
combinations.
• No repeating group.
UNF
Example of 1NF
UNF
Example #2
emp_id emp_name emp_address emp_mobile
101 Betsinat Asella 912312390
981212121
102 Bekalu Addis Ababa
900012222
103 Hermela Adama 977888121
990000123
104 Medin Bishoftu
912345098
Solution
mp_id emp_name emp_address emp_mobile
101 Betsinat Asella 912312390
Addis Ababa
102 Bekalu 981212121
Addis Ababa
102 Bekalu 900012222
103 Hermela Adama 7778881212
104 Medin Bishoftu 990000123
104 Medin Bishoftu 912345098
• all non-key attributes are fully
functional dependent on the
primary key
• No Redundancy
• Break many to many relationship
3NF rules:
• Table must be in 2NF
• Transitive functional dependency of non-prime attribute on any super key
should be removed.
✓ Eliminates fields that do not depend on primary key.
Example
EMP_ID EMP_NAME EMP_ZIP EMP_STATE EMP_CITY
222 Helen 0000 Oromia Adama
333 Selam 0001 AA AA
444 Leul 0000 Oromia Wonji
555 Kebene 0003 Oromia Bishoftu
666 Jalene 0000 Oromia Adama
Candidate key: {EMP_ID}
Non-prime attributes: In the given table, all attributes except EMP_ID are non-prime.
Here, EMP_STATE & EMP_CITY dependent on EMP_ZIP and EMP_ZIP dependent on EMP_ID. The non-prime attributes
(EMP_STATE, EMP_CITY) transitively dependent on super key(EMP_ID). It violates the rule of third normal form.
That's why we need to move the EMP_CITY and EMP_STATE to the new <EMPLOYEE_ZIP> table, with
EMP_ZIP as a Primary key.
Solution
EMP_ID EMP_NAME EMP_ZIP
222 Helen 0000
333 Selam 0001 EMP_ZIP EMP_STATE EMP_CITY
444 Leul 0000 0000 Oromia Adama
0001 AA AA
555 Kebene 0003
0000 Oromia Wonji
666 Jalene 0000
0003 Oromia Bishoftu
0000 Oromia Adama