Normalization is the process of converting a database design into a standard format. The conversion is done into a normal form - which is the standard of designing a database.
Designing database following the normalization could help with some benefits:
There are 3 common normal forms: First Normal Form (1NF), Second Normal Form (2NF) and Third Normal Form (3NF). There are several other normal forms that follow after the 3NF.
Each set of columns must uniquely identify a row
The first normal form (1NF) is the foundation of database normalization.
Example: Name is not a unique key because it can be the same for several people. It doesn't uniquely identify a row - a set of information - a person inside a table.

A Primary Key can be a combination of two or more other fields if when combined, can uniquely identify a row in a table. In this case, NO additional field for Primary Key need to be added.
For example: a combination of Date of Birth and Phone Number could be unique, so it can be a potential candidate for PK. However, when considering the immutability of the PK, we may not choose them , see below.
When choosing a Primary Key, consider the followings:
The Second Normal Form more focuses on how to remove partial relationships. But first, what is a relationship?
A relationship in ER Diagram or Database Design is a way of describing how two table are related or joined to each other.
Is the most common relationship, describing "one A could have many Bs".

In this example, a customer can have one or more orders, in contrast, an order must belong to one and only one customer.
This is not very common.

This is common.

Many-to-many relationship is not ideally good, because it introduces data redundancy and potential for inconsistency. So, it is common to create a joining table that contains the FK of two original tables.
The joining table separate many-to-many relationship to two one-to-many relationships.

This is when a table joins to itself, for example, an employee can have a manager, or a manager can have many employees, but they are in the same table "User".

Fulfil the requirements of First Normal Form and Each non-key attribute must be functionally dependent on the primary key.
In the Second Normal Form, the 1NF must be met, and then all partial dependency must be eliminated.
Partial dependency occurs when a non-key attribute relies on only a portion of the primary key to determine its value.

To resolve, we could separate those attributes that partly depend on the primary key to a separate table, so they can fully/solely depend on their primary key and put only the ID of the new table as a foreign key in the original tables.

Determine which one has many of the other, then put the Foreign Key in the table of the other's table.
For example, a subject can have a teacher, but a teacher can teach many subjects, in this case, the foreign key should be put inside the subject table.

Just following up on the 2NF, Third Normal Form requires the Second Normal Form to be fulfilled (thus the 1NF), and all transitive dependencies should be eliminated.
This means that, no non-key attribute should be indirectly dependent on the primary key through another non-key attribute.

In this example, it follows the Second Normal Form, because there is no non-key attribute that depends on a portion the primary key. However, it violates the Third Normal Form.

To resolve this, we split the table into two, the new one is to store customer data including Customer Name.
Thanks for reading and please let me know if you have any questions or any comments.
That's it!
Posted by