Normalization in DBMS: 1NF, 2NF, 3NF and BCNF

Normalization in DBMS is a database design approach that avoids undesired characteristics such as Insertion, Update, and Deletion Anomalies by reducing data redundancy. Normalization rules break bigger tables into smaller tables and use relationships to connect them. The goal of SQL normalization is to reduce duplicate (repetitive) data and ensure logical data storage.

Data that is redundant costs disc space and causes maintenance issues. If data to be altered is in more than one location, then the data must be modified in the same way in each location. If data is only stored in the Customers table and nowhere else in the database, changing a customer’s address is significantly easier.

With the introduction of the First Normal Form in normalization in DBMS, the architect of the relational model, Edgar Codd, presented the idea of data normalization, which he continued to enhance with the Second and Third Normal Forms. Later, he collaborated with Raymond F. Boyce to establish the Boyce-Codd Normal Form theory.

Importance of Data Normalization in DBMS:

Here are three reasons why Need for normalization in DBMS

  • Reduce the amount of data that is duplicated
  • Segmentation of the Market
  • Metrics And Performance

Reduction of Duplicate Data:

One of the most significant benefits of normalization in DBMS is your data is the reduction of duplicates in your database. It will be easier to discover duplicates if you normalize your data before comparing and combining them.

Market Segmentation:

normalization in DBMS also aids your marketing team in segmenting leads, especially by job title. Job titles vary widely between firms and industries, making it practically hard to link a specific job title to anything useful for lead segmentation or scoring.

Performance and Metrics:

When it comes to evaluating data, databases that aren’t standardized or well-maintained can cause enormous issues. Your data will be substantially easier to sort through if you normalize it and use a single organizational approach with proper capitalization.

Forms of Normalization in DBMS with Examples:

There are several “Normal” database forms in normalization in DBMS. Each normal form has a value that aids in database optimization by reducing redundancies and saving storage.

  • First Normal Form (1 NF)
  • Second Normal Form (2 NF)
  • Third Normal Form (3 NF)
  • Boyce-Codd Normal Form (BCNC)

First Normal Form (1 NF):

If an entity has no recurring groups, it is in the first normal form. A table is said to be in the first normal form if it has no repeating columns. Repeating columns reduces the flexibility of your data, wastes storage space, and makes it more difficult to search for data.

In 1st Normal Form:

  • A single value must be assigned to each table cell.
  • In separate tables, remove any recurring groups.
  • Make a distinct table for each set of data that is connected.
  • The main key should be used to identify each set of linked data.

Second Normal Form (2 NF):

If a relation is in 1NF and every non-key attribute is completely dependent on each potential key of the relation, it is in 2NF.

In 2nd Normal Form:

  • Partially reliant items should be removed.
  • Functional Dependency: In a table, the value of one attribute is totally dependent on the value of another.
  • Partial Reliance: When an attribute is functionally dependent on only a portion of the main key, it is referred to as partial dependency (the primary key must be a composite key).
  • Make a separate table for the functionally dependent data and the key part on which it is dependent. Typically, the tables prepared at this step will include resource descriptions.

Third Normal Form (3 NF):

If a relation is in 2NF and every non-key attribute of the relation is non-transitively dependent on each candidate key of the relation, it is in third normal form.

In 3rd Normal Form:

  • Remove transitive dependencies from the equation.
  • Dependency in the Transitive Sense An attribute is functionally dependent on an attribute other than the primary key in this form of functional dependency.
  • As a result, the primary key only influences its value indirectly.
  • Make a new table with the property and the fields that are functionally reliant on it.
  • Typically, the tables developed at this stage will contain descriptions of resources or agents. In the original file, make a copy of the key attribute.

Also Read: Difference Between SQL and MySQL

Boyce-Codd Normal Form (BCNC):

If every determinant is a candidate key, the relation is in Boyce-Codd Normal Form (BCNF).

The distinction between 3NF and BCNF is that 3NF supports a functional dependency A B in a relation if B is a primary-key attribute and A is not a candidate key, but BCNF does not. BCNF, on the other hand, mandates that A must be a candidate key in order for this reliance to continue in a relationship.

In BCNC:

  • Even though the relation is in 3NF, anomalies can occur if it includes more than one candidate key.
  • The problem of overlapping candidate keys, i.e. composite candidate keys with at least one characteristic in common is not effectively addressed by 3NF.
  • The BCNF is based on the determinant notion.
  • Every determinant must be a candidate key for a relationship to be in BCNF.

Conclusion:

The many types of database normalization are useful when creating a database’s schema to avoid data replication, which can lead to discrepancies. We should always consider how we may use these forms when building the schema for applications.

FAQs:

Is it necessary to normalize your databases?

It depends on the circumstances, but the most sensible suggestion is “if you can, do it.”

Why do we use normalization in SQL?

The goal of database normalization is to streamline data by removing unnecessary information.

Why normalization is bad?

Normalization minimizes overall complexity and can speed up querying. Too much normalization, on the other hand, can be equally harmful, as it comes with its own set of issues.