So, last time on MGM, I discussed about database optimization. Well, in order to have full database optimization, there is something that will have to be done, which is: Database Normalization.
What Is It?
Database normalization is an organizing process of which you are eliminating redundancy as much as possible. This includes tables, fields, and all of the data in general. This also will ensure that all the data is stream-lined, which means that all core data can be easily linked to its corresponding data, and so on.
How Do You Normalize Your Data?
The simple answer is to make sure that there are absolutely no redundancies, duplication, or anomalies in your data. However, there is a process that you can go through in order to fully normalize your data.
- First Normal Form (1NF)
- Second Normal Form (2NF)
- Third Normal Form
First normal form is fairly simple. In order to achieve 1NF, make sure that ALL columns in your table only have one value in them. Basically, this means that separate all columns in your table that have multiple values in them. In order to do this, put the multi-value column into a new table using the key of the original table as the key of the new table. This will satisfy 1NF.
Second normal form is a little more complicated. In order to achieve 2NF, make sure that no non-prime attributes are functionally dependent on a partial key. What does this mean in non-technical terms? This means that for any column that is not a key, that value should not be dependent (directly connected) to a partial key. So, take for example the following relational table below:
CAR_SALE(Car#, Date_Sold, Salesperson#, Commission%, Discount_Amt)
Now, if you take a look at the table, what’s the first connection you see in the data? I see: Salesperson# and Commission% right off the bat. So, in order to satisfy 2NF, we separate these values:
SALES_PERSON(Salesperson#, Commission%)
..and the original table:
CAR_SALE(Car#, Date_Sold, Salesperson#, Discount_Amt)
Notice how I separated the Commission% from CAR_SALE, but still kept Salesperson# in CAR_SALE? The key value remains in the original table in order to establish a Foreign Key, which links these two tables together.
Now, with this completed, 2NF has been satisfied.
Third normal form is pretty similar to second normal form. In order to achieve 3NF, make sure that no non-prime attributes are functionally dependent on another non-prime attribute. So, basically this means that no non-key attribute should be directly associated with another non-key attribute. So, how does this look? Take for example the two tables that we created after satisfying 2NF:
CAR_SALE(Car#, Date_Sold, Salesperson#, Discount_Amt)
SALES_PERSON(Salesperson#, Discount_Amt)
Now, do you see any connection for any attributes that are not underlined? I do: Date_Sold and Discount_Amt in CAR_SALE. How are these related? Well, thinking of this as a database for car sales, managers would want to keep track of the discount amounts that were given out per day to track said discounts on a quarterly basis. So, for this example, we have to separate those two attributes into their own table:
DATE_DISCOUNT(Date_Sold, Discount_Amt)
and the other two tables:
SALES_PERSON(Salesperson#, Commission%)
CAR_SALE(Car#, Date_Sold, Salesperson#)
Now with this complete, we have satisfied 3NF.
There of course are more normal forms than this, but by following these basic normal form steps, your tables will be approximately 85% normalized. To view more normal forms, check out here: http://en.wikipedia.org/wiki/Database_normalization (yes I know it’s wikipedia, but other sites that I looked at froze up my PC).
If you have questions or comments about database normalization, feel free to contact me! I will be more than happy to answer/respond to any questions/comments that you may have. 🙂
That’s all for now, until next time…keep that tech gear ticking.
~Goliath7470

I was curious if you ever thought of changing the structure of your website? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures. Maybe you could space it out better?
I was thinking about this before. I probably should be providing more pictures/illustrations in order to back up the content that I write.
Thank you for your feedback! 🙂
~Goliath7470