NORMALIZATION. What is Normalization The process of effectively organizing data in a database Two...

10
NORMALIZATION

Transcript of NORMALIZATION. What is Normalization The process of effectively organizing data in a database Two...

Page 1: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

NORMALIZATION

Page 2: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

What is Normalization

The process of effectively organizing data in a database

Two goals To eliminate redundant data Ensure data dependencies make sense

Guidelines are called normal forms There are 1 thru 6 They are guidelines - not cast in

concrete

Page 3: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

1st Normal form

Written as 1NF Eliminates duplicate column from the

same table Creates separate tables for each group

of related data Identifies each row with a unique column

or set of columns – Primary Key

Page 4: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

2nd Normal Form

Must meet all first normal form requirements

Removes subsets of dta that apply to multiple rows of a table and puts them in separate tables

Creates relationships between these new tables and their predecessors thru the use of Foreign Keys

Page 5: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

3rd Normal Form

Meets all the requirements of second normal form

Removes columns that are not dependent upon the primary key

Page 6: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

4th Normal Form – Boyce Codd Meets all the requirements of the 3rd

normal form Has no multi-valued dependencies

Page 7: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

5th Normal Form

Fifth normal form deals with cases where information can be reconstructed from smaller pieces of information that can be maintained with less redundancy.

Second, third, and fourth normal forms also serve this purpose, but fifth normal form generalizes to cases not covered by the others.

Page 8: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

6th Normal Form

Must be in 5th normal form Sixth normal form is intended to decompose

relation variables to irreducible components. Though this may be relatively unimportant for non-

temporal relation variables, it can be important when dealing with temporal variables or other interval data.

For instance, if a relation comprises a supplier's name, status, and city, we may also want to add temporal data, such as the time during which these values are, or were, valid (e.g. for historical data) but the three values may vary independently of each other and at different rates.

We may, for instance, wish to trace the history of changes to Status.

Page 9: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

Primary Key

The primary key of a table must be unique to identify the record in the table.

It's also possible to have a table with a primary key made up of two or more columns.

This occurs when a single column can't contain enough unique values. For example, a two column primary key

might consist of a "FirstName" and "LastName" column.

Page 10: NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.

Foreign Key

A foreign key is a field (or fields) that points to the primary key of another table.

The purpose of the foreign key is to ensure referential integrity of the data.

Customer table – customer Id is the primary key

In an Orders table – the customer id is the foreign key