0% found this document useful (0 votes)
132 views

Normalization: Database Normalization Was First Proposed by Edgar F. Codd

Database normalization is a process of structuring a database to reduce data redundancy and improve data integrity. It involves organizing tables and columns to ensure that each attribute depends on the primary key. There are several normal forms with increasing strictness - 1NF, 2NF, 3NF and BCNF. The goal of normalization is to eliminate anomalies like insertion, deletion and update anomalies.

Uploaded by

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

Normalization: Database Normalization Was First Proposed by Edgar F. Codd

Database normalization is a process of structuring a database to reduce data redundancy and improve data integrity. It involves organizing tables and columns to ensure that each attribute depends on the primary key. There are several normal forms with increasing strictness - 1NF, 2NF, 3NF and BCNF. The goal of normalization is to eliminate anomalies like insertion, deletion and update anomalies.

Uploaded by

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

Normalization

Database Normalization was first proposed by Edgar F. Codd.


Design Guidelines for Relational Databases

• Relational database design: The grouping of attributes to form "good"


relation schemas
• Two levels of relation schemas:
• The logical "user view" level
• The storage "base relation" level
• Design is concerned mainly with base relations
• Criteria for "good" base relations:
• Discuss informal guidelines for good relational design
• Discuss formal concepts of functional dependencies and normal forms 1NF 2NF
3NF BCNF
Normalization is a process that “improves” a database design by generating
relations that are of higher normal forms.

Process of decomposing unsatisfactory "bad" relations by breaking up their


attributes into smaller relations

The main goal of Database Normalization is to restructure the logical data


model of a database to:

• Eliminate redundancy
• Organize data efficiently
• Reduce the potential for data anomalies.
Objective of Normalization

“to create relations where every dependency is on the key, the whole key,
and nothing but the key”.

There is a sequence to normal forms:


1NF is considered the weakest,
2NF is stronger than 1NF,
3NF is stronger than 2NF, and
BCNF is considered the strongest

Also,
any relation that is in BCNF, is in 3NF;
any relation in 3NF is in 2NF; and
any relation in 2NF is in 1NF.
Normalization

1NF a relation in BCNF, is also in


3NF
2NF
a relation in 3NF is also in 2NF
3NF
a relation in 2NF is also in 1NF
BCNF
Functional Dependencies

Functional dependencies (FDs) are used to specify formal measures of the


"goodness" of relational designs.

A set of attributes X functionally determines a set of attributes Y if the value


of X determines a unique value for Y.

X Y holds if whenever two tuples have the same value for X, they must
have the same value for Y.
If t1[X]=t2[X], then t1[Y]=t2[Y] in any relation instance r(R)

X  Y in R specifies a constraint on all relation instances r(R).


Suppose we keep track of employee email addresses, and we only track one
email address for each employee.

Suppose each employee is identified by their unique employee number.

We say there is a functional dependency of email address on employee


number:

employee number  email address


Social Security Number determines employee name
SSN  ENAME

Project Number determines project name and location


PNUMBER  {PNAME, PLOCATION}
Transitive Dependency

Consider attributes A, B, and C, and where


A  B and B  C.

Functional dependencies are transitive, which means that we also


have the functional dependency
AC

We say that C is transitively dependent on A through B.


Transitive dependency

EmpNum  DeptNum

EmpNum EmpEmail DeptNum DeptNname

DeptNum  DeptName

EmpNum EmpEmail DeptNum DeptNname

DeptName is transitively dependent on EmpNum via DeptNum


EmpNum  DeptName
Data Anomalies

Data anomalies are inconsistencies in the data stored in a database as a


result of an operation such as update, insertion, and/or deletion.
Such inconsistencies may arise when have a particular record stored in
multiple locations and not all of the copies are updated.
First Normal Form

The requirements to satisfy the 1st NF:

Each table has a primary key: minimal set of attributes which can
uniquely identify a record.

The values in each column of a table are atomic (No multi-value


attributes allowed).

There are no repeating groups: two columns do not store similar


information in the same table.
1st Normal Form Example

Un-normalized Students table:


Student# AdvID AdvName AdvRoom Class1 Class2
123 123A James 555 102-8 104-9
124 123B Smith 467 209-0 102-8
Normalized Students table:

Student# AdvID AdvName AdvRoom Class#


123 123A James 555 102-8
123 123A James 555 104-9
124 123B Smith 467 209-0
124 123B Smith 467 102-8
Second Normal Form

A relation is in 2NF if it is in 1NF, and every non-key attribute is fully


dependent on each candidate key. (That is, we don’t have any partial
functional dependency.)

• 2NF (and 3NF) both involve the concepts of key and non-key attributes.

• A key attribute is any attribute that is part of a key; any attribute that is not a
key attribute, is a non-key attribute.
The requirements to satisfy the 2nd NF:

• All requirements for 1st NF must be met.

• Redundant data across multiple rows of a table must be moved to


a separate table.
o The resulting tables must be related to each other by use of
foreign key.
2nd Normal Form Example

Students table
Student# AdvID AdvName AdvRoom
123 123A James 555
124 123B Smith 467
Registration table

Student# Class#
123 102-8
123 104-9
124 209-0
124 102-8
3rd Normal Form

The requirements to satisfy the 3rd NF:


• All requirements for 2nd NF must be met.

• Eliminate fields that do not depend on the primary key;


• That is, any field that is dependent not only on the primary
key but also on another field must be moved to another table.
3rd Normal Form
Students table:
Student# AdvID AdvName AdvRoom
123 123A James 555
124 123B Smith 467

Student table: Advisor table:


Student# AdvID AdvID AdvName AdvRoom
123 123A 123A James 555
124 123B 123B Smith 467
3rd Normal Form
Students table:
Student# AdvID
123 123A
124 123B
Registration table: Advisor table:
Student# Class# AdvID AdvName AdvRoom
123 102-8 123A James 555
123 104-9 123B Smith 467
124 209-0
124 102-8
Boyce Codd normal form (BCNF)

It is an advance version of 3NF that’s why it is also referred as 3.5NF.

BCNF is stricter than 3NF. A table complies with BCNF if it is in 3NF and for
every functional dependency X->Y, X should be the super key of the table.

Suppose there is a company wherein employees work in more than one


department. They store the data like this:
Functional dependencies in the table above:
emp_id -> emp_nationality
emp_dept -> {dept_type, dept_no_of_emp}

Candidate key: {emp_id, emp_dept}


The table is not in BCNF as neither emp_id nor emp_dept alone are keys.

To make the table comply with BCNF we can break the table in three tables like
this:

emp_nationality table:

emp_id emp_nationality
1001 Austrian
1002 American
emp_dept table:

emp_dept dept_type dept_no_of_emp


Production and planning D001 200
stores D001 250
design and technical
D134 100
support
Purchasing department D134 600
emp_dept_mapping table:

emp_id emp_dept
1001 Production and planning
1001 stores
1002 design and technical support
1002 Purchasing department
References
• Hillyer Mike, MySQL AB. An Introduction to Database Normalization,
http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html, accessed
October 17, 2006.

• Microsoft. Description of the database normalization basics,


http://support.microsoft.com/kb/283878 , accessed October 17, 2006.

• Wikipedia. Database Normalization.


http://en.wikipedia.org/wiki/Database_normalization.html , accessed October 17,
2006.

You might also like