0% found this document useful (0 votes)
33 views57 pages

Fundamental of Datawarehousing 3

The document discusses database normalization. It begins by describing problems that can occur without normalization like data redundancy, insertion anomalies, deletion anomalies, and update anomalies. It then defines normalization as a technique for organizing data into multiple tables to minimize redundancy. The document outlines the three common forms of normalization - 1st, 2nd, and 3rd normal form. It provides examples to illustrate key concepts like functional dependencies and when tables violate different forms of normalization due to issues like partial and transitive dependencies. Overall, the document aims to explain the basic concepts of database normalization and how it addresses problems arising from data redundancy.

Uploaded by

Jayson Meperaque
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views57 pages

Fundamental of Datawarehousing 3

The document discusses database normalization. It begins by describing problems that can occur without normalization like data redundancy, insertion anomalies, deletion anomalies, and update anomalies. It then defines normalization as a technique for organizing data into multiple tables to minimize redundancy. The document outlines the three common forms of normalization - 1st, 2nd, and 3rd normal form. It provides examples to illustrate key concepts like functional dependencies and when tables violate different forms of normalization due to issues like partial and transitive dependencies. Overall, the document aims to explain the basic concepts of database normalization and how it addresses problems arising from data redundancy.

Uploaded by

Jayson Meperaque
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Basic Concept of Database Normalization

Basic Concept of Database


Normalization
Start with understanding:

• Problems without Normalization

• How Normalization solves these problems


Basic Concept of Database
Normalization
What Is a Normalization?

➢A technique of organizing the data into


multiple related tables, to minimize Data
Redundancy.
Basic Concept of Database
Normalization
What Is a Data Redundancy?

Why should we reduce it?


Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization

Issues due to redundancy:

• Insertion Anomaly

• Deletion Anomaly

• Updation Anomaly
Basic Concept of Database
Normalization
Insertion Anomaly
• To insert
redundant data
for every new row
(of Student data in
our case) is a data
insertion problem
or anomaly
Basic Concept of Database
Normalization
Deletion
Anomaly
• Loss of a
related dataset
when some
other dataset is
deleted
Basic Concept of Database
Normalization
Issue while
modifying the
data…
(Updation
Anomaly)
Basic Concept of Database
Normalization

How Normalization will solve these problems


Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
Normalization is good – solved the problems
Basic Concept of Database
Normalization
Types of Normalization

• 1st Normal Form (1NF)

• 2nd Normal Form (2NF)

• 3rd Normal Form (3NF)


Basic Concept of Database
Normalization
What problems arise due to Data redundancy

How Normalization makes the Data more


meaningful and useable.
Basic Concept of Database
Normalization
1st Normal Form

• Scalable Table design which can be easily


extended

• If your table is not even in 1st Normal Form, it’s


considered poor DB design
Basic Concept of Database
Normalization
1st Normal Form

• There are 4 basic rules that a table should


follow to be in the 1st Normal Form.
Basic Concept of Database
Normalization
1st Normal Form
Basic Concept of Database
Normalization
1st Normal Form
Basic Concept of Database
Normalization
1st Normal Form
Basic Concept of Database
Normalization
1st Normal Form
Basic Concept of Database
Normalization
1st Normal Form
Basic Concept of Database
Normalization
1st Normal Form
Basic Concept of Database
Normalization
2nd Normal Form

• It should be in 1st Normal Form

• It should not have any Partial Dependency.

• What is Partial Dependency?


Basic Concept of Database
Normalization
Partial Dependent

Partial Dependent
Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
2nd Normal Form
Primary Key
Basic Concept of Database
Normalization
2nd Normal Form
Basic Concept of Database
Normalization
2nd Normal Form

A Primary Key can be used to fetch data from any


column in the table
Basic Concept of Database
Normalization
2nd Normal Form

This is
Dependency
or Functional
Dependency
Basic Concept of Database
Normalization
2nd Normal Form

Functional Dependency
Basic Concept of Database
Normalization
2nd Normal Form

Primary Key will be the score_id


But student_id + subject_id together makes a more meaningful primary key
Basic Concept of Database
Normalization
2nd Normal Form

One Student can opt for more than one Subject


One Subject can be opted by more than one Student
Basic Concept of Database
Normalization
2nd Normal Form

student_id + subject_id can uniquely identify any row of data in SCORE table
Basic Concept of Database
Normalization
2nd Normal Form

Primary Key (in Score Table) is a composition of two columns


Student_id + subject_id
Basic Concept of Database
Normalization
2nd Normal Form
Teacher column
only depends
on subject and
not on student.
This is Partial
Dependency.

For 2nd Normal Form, this should not exist. How to remove it?
Basic Concept of Database
Normalization
2nd Normal Form

Move teacher column to Subject Table


Basic Concept of Database
Normalization
2nd Normal Form

Makes more sense here


Basic Concept of Database
Normalization
2nd Normal Form

Can even add more info related to teachers like date of joining, salary, etc.
Basic Concept of Database
Normalization
3rd Normal Form

• It should be in the 2nd Normal Form

• It should be not have Transitive Dependency

• What is Transitive Dependency?


Basic Concept of Database
Normalization

transitive functional dependency


Basic Concept of Database
Normalization
Basic Concept of Database
Normalization
3rd Normal Form

With exam_name and total_marks fields added…


Basic Concept of Database
Normalization
3rd Normal Form

Primary Key for Score table is composite key. This means student_id +
subject_id
Column exam_name depends on the primary key.
Basic Concept of Database
Normalization
3rd Normal Form

total_marks (attribute) not depends on the primary but on exam_name (non primary attribute)
Basic Concept of Database
Normalization
3rd Normal Form

total_marks (attribute) not depends on the primary but on exam_name (non prime attribute)
Basic Concept of Database
Normalization
3rd Normal Form
Basic Concept of Database
Normalization
Key Take-away:

• As the data requirement increases, Database


complexity increases, and the need for
Normalization too increases.
Basic Concept of Database
Normalization
Remember:
• 2NF - no partial dependency
• A (prime attribute) depends on B (non-prime attribute) = (Functional
Dependency)
• If A is part of the Key (AXY), but B depends on A, B doesn’t depend on AXY,
then, this is partial dependency.
• 3NF - no transitive dependency
• If A is non-prime attribute and B is non-prime attribute, then, this is
transitive dependency.
Basic Concept of Database
Normalization
Thank you!

You might also like