DEV Community

pjl5401
pjl5401

Posted on

Normalization and the Different Types of Normal Form

Hey everyone!
In this weeks post I am going to be explaining the different normal data types that are within my COVID-19 database. In last weeks video, I showcased the COVID-19 database that I had just created and explained the different commands within SQL to edit/add data to different rows and columns. With normalization, I am going to be able to clean up my database tables and make it much more efficient and less crowded with data that is not necessarily needed to get the data that is needed.

So what is normalization? Normalization is the process of adjusting the data in a database to make it follow a certain set of criteria. There are six different normal data types, and each one builds off of the previous one. For example, in order for it to be second normal form, it must include all of the criteria from first normal form in order for it to be considered second normal form. This is the case for all six forms. So, as shown in my table of behavior, this would be considered first normal form because it meets the criteria of being uniquely identified by a primary key, in this case it is behavior_ID, the data in the table is reduced to it’s simplest form, and no groups are repeated.
Here is my Behavior table:

Alt Text

An example of a data table that could use some cleaning up would be my Risk table. The column that could be eliminated would be the ImmunoCompromised column. The column next to it is MedicalConditions, so therefore if one fills out a particular medical condition that they have, it can be assumed that they have an increased risk of death from the disease due to the fact that it indicates they could potentially be immune-compromised. To fix this, I removed the ImmunoCompromised column using the ALTER command and decided to base whether or not you are at a higher risk of death on MedicalConditions instead.
As you can see in the image below, I have dropped the ImmunoCompromised column from the table.

Alt Text

An example of second normal form within my database would be in the Occupation table. In order for data to be considered second normal form, it has to meet the criteria of everything from the first normal form, and it has to be data that only relates to the table’s primary key. To show this in my Occupation table, all of the data in the table depends on the Employee_ID column because the given employee ID states what your job is and whatever your job is determines the data for the rest of the columns in the table.

Alt Text

In this weeks video, I have gone through the different types of normal forms and demonstrated the differences between them based on my own database. I also did a walkthrough of how to use the ALTER command. Hope you enjoy!
https://www.youtube.com/watch?v=8N__Ob0TDwk

Top comments (0)