Download presentation
1
Rules of Database Normalization
4/24/2017
2
Overview What is Normalization?
What is the objective of Normalization? Why is Normalization in a database important? What are NORMAL FORMS? How do we accomplish Normalization in our database? Are there times when Normalization is unnecessary? 4/24/2017
3
What is Normalization? Normalization refers to the process of creating an efficient, reliable, flexible, and appropriate “relational” structure for storing information in a “relational” data structure. Normalization usually involves dividing a database into two or more tables and defining the relationship between the tables. 4/24/2017
4
What is the objective of Normalization?
The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships. 4/24/2017
5
Why is Normalization in a database important?
Normalization removes redundant data from your tables in order to improve storage efficiency. Normalization removes redundant data and improves data integrity. Normalization removes redundant data and helps in maintenance problems. Example: If data that exists in more than one place must be changed, the data must be changed in exactly the same way in all locations. Finally, Normalization removes redundant data and improves the scalability of your database. 4/24/2017
6
What are NORMAL FORMS? A series of logical steps to normalize data tables. First Normal Form-1NF Second Normal Form-2NF Third Normal Form-3NF Fourth Normal Form-4NF Fifth Normal Form-5NF We will learn the First, Second and Third Normal Forms 4/24/2017
7
What is the First Normal Form?
The definition of the first Normal Form is as follows There are no repeating groups. All of the key attributes are defined. All attributes are dependent on the primary key. Example on the next slide. 4/24/2017
8
How do we accomplish First Normal Form? Look at this example.
Project Number Project Name Employee Number Name-1 Rate Category-1 Hourly Rate-1 Name 2 Category 1023, 1056 Madagascar Travel site and Online Estate Agency 11 Julius Wilson A $60 Monica Jefferson B $50 1023 Travel site 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
9
Notice the repeating Groups.
Project Number Project Name Employee Number Name-1 Rate Category-1 Hourly Rate-1 Name 2 Category 1023, 1056 Madagascar Travel site and Online Estate Agency 11 Julius Wilson A $60 Monica Jefferson B $50 1023 Travel site 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
10
This is our solution to eliminating the repeating groups
Project Number Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
11
How can we set our Primary Key?
Project Number Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
12
Can this be our Primary Key?
Project Number Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
13
Or, can this be our Primary Key?
Project Number Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
14
Solution-We need both as our Primary Keys.
Project Number Primary Key Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
15
Is our table in First Normal Form?
Project Number Primary Key Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
16
What is Second Normal Form
A table is in 2nd Normal Form if: It is in 1st normal form. It includes no partial dependencies (where an attribute is dependent on only a part of a primary key). 4/24/2017
17
Does it include partial dependencies? Do you notice anything else?
Project Number Primary Key Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 Madagascat 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
18
Look at “Project Name” Row 3. Also look at Hourly Rate
Look at “Project Name” Row 3. Also look at Hourly Rate? What about data integrity? Project Number Primary Key Project Name Employee Number Rate Category Hourly 1023 Madagascar Travel site 11 Julius Wilson A $60 12 Monica Jefferson B $50 Madagascat 16 Daniel Moore C $40 1056 Online Estate Agency 17 Charles Saul D $30 4/24/2017
19
Step One: Project Name is only Dependent on Project
Employee-Project Table Project Name Employee Number 1023 11 12 16 1056 17 Project Name is only Dependent on Project Number; so, we create a “Employee Project Table.” 4/24/2017
20
Step Two: Notice that “Project Name” is dependent on only
Project Table Project Number Primary Key Project Name 1023 Madagascar Travel site 1056 Online Estate Agency Notice that “Project Name” is dependent on only “Project Number.” We create our “Project Table” With Project Number as our Primary Key. Look at the space we have saved. What else have we done? 4/24/2017
21
Step Three: Notice that Employee Name, Rate Category,
Employee Table Employee Number Primary Key Name Rate Category Hourly 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 17 Charles Saul D $30 Notice that Employee Name, Rate Category, and Hourly Rate are dependent on Employee Number. We create our “Employee Table” with Employee Number as our Primary Key. 4/24/2017
22
Are we now in Second Normal Form?
Employee Project Table Employee Project Table Project Table Project Table Employee Table Project Name Primary Key Employee Number Primary Key 1023 11 12 16 1056 17 Project Name Primary Key Employee Number Primary Key 1023 11 12 16 1056 17 Project Number Primary Key Project Name 1023 Madagascar Travel site 1056 Online Estate Agency Employee Number Primary Key Name Rate Category Hourly 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 17 Charles Saul D $30 Is it in First Normal Form and does it includes no partial Dependencies? 4/24/2017
23
Now, What is Third Normal Form?
It is in SECOND Normal Form. It contains no transitive dependencies (where a non-key attribute is dependent on another non-key attribute). Let’s see where we begin. 4/24/2017
24
Let’s take another look at what we have.?
Employee Project Table Employee Project Table Project Table Project Table Employee Table Project Name Primary Key Employee Number Primary Key 1023 11 12 16 1056 17 Project Number Primary Key Project Name 1023 Madagascar Travel site 1056 Online Estate Agency Employee Number Primary Key Name Rate Category Hourly 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 17 Charles Saul D $30 4/24/2017
25
Let’s look at the Employee Project Table
Can we do anything else with this table? Employee Project Table Project Name Primary Key Employee Number Primary Key 1023 11 12 16 1056 17 4/24/2017
26
Let’s Look at the Project Table.
Can we do anything else with this table? Project Table Project Number Primary Key Project Name 1023 Madagascar Travel site 1056 Online Estate Agency 4/24/2017
27
Let’s look at the Employee table
Can we further normalize this table? Employee Table Employee Number Primary Key Name Rate Category Hourly 11 Julius Wilson A $60 12 Monica Jefferson B $50 16 Daniel Moore C $40 17 Charles Saul D $30 4/24/2017
28
See what we can do with the employee table.
Let’s make an “Rate” Table Employee Table Rate Table We have now reduced the possibility of Employees being paid Incorrectly. Our database Will have more integrity. Employee Number Primary Key Name Rate Category 11 Julius Wilson A 12 Monica Jefferson B 16 Daniel Moore C 17 Charles Saul D Rate Category Primary Key Hourly A $60 B $50 C $40 D $30 4/24/2017
29
That’s It! Our data is now in 3NF.. Ready to be used in a DBMS…
4/24/2017
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.