Database Normalization
Database Normalization
Database normalization is the process of organizing the attributes and tables of a relational
database to minimize redundancy and dependency.
It helps in reducing data redundancy, ensures data consistency, and improves data integrity.
The normal forms include 1NF (First Normal Form), 2NF (Second Normal Form), 3NF
(Third Normal Form), BCNF (Boyce-Codd Normal Form), 4NF (Fourth Normal Form), and
5NF (Fifth Normal Form).
1NF requires that each column in a table contain atomic values and that there are no
repeating groups of columns.
2NF eliminates partial dependencies by ensuring that each non-key attribute is fully
dependent on the entire primary key.
5NF is based on the concept of join dependencies and ensures that a database is free from
join anomalies.
Beyond 3NF, normalization further refines the database structure to eliminate even more
complex forms of data redundancy and dependency.
Normalization reduces redundancy, which minimizes the risk of data anomalies such as
insertion, update, and deletion anomalies, thereby improving data integrity.
A deletion anomaly occurs when deleting certain data inadvertently removes other data that
should be retained.
By organizing data into separate tables and eliminating repeating groups, normalization
ensures that each piece of information is stored in only one place.
A functional dependency exists when the value of one attribute uniquely determines the
value of another attribute in the same table.
A composite key is a combination of two or more attributes that uniquely identify a record in
a database table.
Candidate keys are potential primary keys within a table, and they help identify functional
dependencies and determine table structures during normalization.
21. What is the difference between horizontal and vertical partitioning in normalization?
Horizontal partitioning divides a table into smaller tables with the same schema but different
rows, while vertical partitioning divides a table into smaller tables with the same rows but
different columns.
Referential integrity constraints enforce relationships between tables, ensuring that foreign
key values correspond to primary key values, thus maintaining data consistency.
Functional dependencies occur when one attribute determines another, while multivalued
dependencies occur when one attribute determines multiple values of another attribute.
Normalization ensures that data is stored in a consistent manner across tables, reducing the
risk of inconsistencies and improving overall data quality.