DEV Community

Discussion on: ELI5: What is a database normalization?

Collapse
nonsobiose profile image
Nonso Biose

All the above are quite explanatory, but let me add a few things.

When a database has tables with data being repeated that data that is repeated is said to be redundant(Not needed and should be eliminated or better still be organized in a better way).

That better way of data organization in order to reduce REDUNDANCY is called NORMALIZATION.

Normalization is the reduction of data duplication i.e redundancy. This concept was introduced by DR Edgar F. Codd. and he formulated 4 forms in which data redundancy can be archived. The forms are as follows : 1NF, 2NF, 3NF and 4NF(formulated by Codd and Boyce A.K.A. BCNF).

1NF (First Normalization form)

Now this forms says that if your data is redundant in the following ways:
*one table cell containing multiple values
*one column/attribute having repeating groups i.e phoneNumber1, phoneNumber2 etc
*your rows dont have primary keys that uniquely identifies them
You should do this:
*Each should cell contain single values
*Move repeating groups i.e phoneNumber1, phoneNumber2 to seprate tables
*Have primary keys that uniquely identifies each row.

2NF (Second Normalization form)

Now this forms says that if your data is redundant in the following ways:
*If you have a composite key which your other non primary keys dont depend on.
. . . it basically says that all non-prime keys(keys that are not primary, composite or candidate) should depend on the composite keys that exist in a table else, move the non dependent ones to another table. This form focuses on Functional dependency i.e B is functionally dependent on A if A affects B.

3NF (Third Normalization form)

This form is quite similar to the Third normal form but it goes on to say that there shouldnt be any existence of Referential Dependency i.e a non-prime key should not depend on another non prime key instead, it should depend on only the existing primary or composite keys.

The fourth one is quite confusing cant explain it
(Here is a link )[en.wikipedia.org/wiki/Fourth_norma...]

NOTE:
The 2nd, 3rd and 4th forms require that forms prior to them be first fulfilled.
i.e for a table to be in its fourth form, it must first pass the 1st, 2nd and 3rd forms.

i hope this helps

Collapse
gladuz profile image
Jamshid Tursunboyev Author

I didn't know about NFs. Thank you!