You are on page 1of 17

Database Normalization

Ruben A. Parazo
Faculty, Department of Computer Studies
Database Normalization
• Is a technique of organizing the data in the database. Normalization is
a systematic approach of decomposing tables to eliminate data
redundancy(repetition) and undesirable characteristics like Insertion,
Update and Deletion Anomalies. It is a multi-step process that puts
data into tabular form, removing duplicated data from the relation
tables.
• Is a database schema design technique, by which an existing schema
is modified to minimize redundancy and dependency of data.
• Normalization split a large table into smaller tables and define
relationships between them to increases the clarity in organizing data.
Purpose of Normalization
• Eliminating redundant(useless) data.
• Ensuring data dependencies make sense i.e data is logically stored.
Advantages of Normalization
• Prevent the Same Data from Being Stored in Many Places
• Prevent Updates Made to Some Data and Not Others
• Prevent Deleting Unrelated Data
• Ensure Queries are More Efficient
Normalization Rule

• First Normal Form


• Second Normal Form
• Third Normal Form
• BCNF
• Fourth Normal Form
First Normal Form
• Rules
• It should only have single(atomic) valued attributes/columns.
• Values stored in a column should be of the same domain
• All the columns in a table should have unique names.
• And the order in which data is stored, does not matter
First Normal Form
Rule 1: Single Valued Attributes
• Each column of your table should be single valued which means they
should not contain multiple values. We will explain this with help of
an example later, let's see the other rules for now.
First Normal Form
Rule 2: Attribute Domain should not change
• This is more of a "Common Sense" rule. In each column the values
stored must be of the same kind or type.
• For example: If you have a column dob to save date of births of a set
of people, then you cannot or you must not save 'names' of some of
them in that column along with 'date of birth' of others in that
column. It should hold only 'date of birth' for all the records/rows
First Normal Form
Rule 3: Unique name for Attributes/Columns
• This rule expects that each column in a table should have a unique
name. This is to avoid confusion at the time of retrieving data or
performing any other operation on the stored data.
First Normal Form
Rule 4: Order doesn't matters
• This rule says that the order in which you store the data in your table
doesn't matter.
First Normal Form
emp_id emp_name emp_address emp_mobile Table not in First Normal Form
101 Herschel New Delhi 8912312390
8812121212
102 Jon Kanpur
9900012222
103 Ron Chennai 7778881212
9990000123
104 Lester Bangalore
812345098 Conversion of the table in First Normal Form
emp_id emp_name emp_address emp_mobile
101 Herschel New Delhi 8912312390
102 Jon Kanpur 8812121212
102 Jon Kanpur 9900012222
103 Ron Chennai 7778881212
104 Lester Bangalore 9990000123
104 Lester Bangalore 812345098
Second Normal Form
• It should be in the First Normal form.
• No non-prime attribute is dependent on the proper subset of any
candidate key of table.
• An attribute that is not part of any candidate key is known as non-prime
attribute.
Second Normal Form
Teacher_id Subject Age
111 Math 33
111 Physics 33
222 Biology 35
333 Physics 40
333 Chemistry 40
• Candidate Keys: {teacher_id, subject}
Non prime attribute: teacher_age
To make the table complies with 2NF we can
break it in two tables like this:
Teacher_Id Teacher_age
Teacher_id Subject Age
111 33 111 Math 33
222 35
111 Physics 33
333 40
222 Biology 35
333 Physics 40
333 Chemistry 40
Third Normal form (3NF)
• A table design is said to be in 3NF if both the following conditions
hold:
• Table must be in 2NF
• Transitive functional dependency of non-prime attribute on any
super key should be removed.
• An attribute that is not part of any candidate key is known as non-prime
attribute.
• An attribute that is a part of one of the candidate keys is known as prime
attribute.
Third Normal form (3NF)
Graphical Representation
emp_id emp_name emp_zip emp_state emp_city emp_district

1001 John 282005 UP Agra Dayal Bagh

1002 Ajeet 222008 TN Chennai M-City

1006 Lora 282007 TN Chennai Urrapakkam

1101 Lilly 292008 UK Pauri Bhagwan

1201 Steve 222999 MP Gwalior Ratan


Third Normal form (3NF)
Graphical Representation
emp_id emp_name emp_zip Emp_zip emp_state emp_city emp_district

1001 John 282005 282005 UP Agra Dayal Bagh


1002 Ajeet 222008 222008 TN Chennai M-City
1006 Lora 282007 282007 TN Chennai Urrapakkam
1101 Lilly 292008
292008 UK Pauri Bhagwan
1201 Steve 222999
222999 MP Gwalior Ratan

You might also like