320 likes | 736 Views
Rules of Database Normalization. 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?.
E N D
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?
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.
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.
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.
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
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.
How do we accomplish First Normal Form? Look at this example.
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).
Does it include partial dependencies? Do you notice anything else?
Look at “Project Name” Row 3. Also look at Hourly Rate? What about data integrity?
Step One: Employee-Project Table Project Name is only Dependent on Project Number; so, we create a “Employee Project Table.”
Step Two: Project Table 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?
Step Three: Employee Table 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.
Are we now in Second Normal Form? Project Table Project Table Employee Project Table Employee Table Employee Project Table Is it in First Normal Form and does it includes no partial Dependencies?
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.
Let’s take another look at what we have.? Project Table Project Table Employee Project Table Employee Table Employee Project Table
Let’s look at the Employee Project Table Employee Project Table Can we do anything else with this table?
Let’s Look at the Project Table. Can we do anything else with this table? Project Table
Let’s look at the Employee table Employee Table Can we further normalize this table?
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.
That’s It! • Our data is now in 3NF.. • Ready to be used in a DBMS…