Normalization
- Normalization is the process of organizing the data in the database.
- Normalization is used to,
Eliminate the undesirable characteristics like Insertion, Updates and Deletion Anomalies.
- Normalization divides the larger table into the smaller table and links them using relationship.
- The normal form is used to reduce redundancy from the database table.
Types of Normal Forms
There are four types of normal forms,
- 1NF
- 2NF
- 3 NF
- BCNF
- 4 NF
- 5 NF
First Normal Form (1NF)
- A relation will be 1NF if it contains an atomic value.
- It states that an attribute of a table cannot hold multiple values. It must hold only single-valued attribute.
- First normal form disallows the multi-valued attribute, composite attribute, and their combinations.
- There are only Single Valued Attributes.
- Attribute Domain does not change.
- There is a unique name for every Attribute/Column.
- The order in which data is stored does not matter.
Second Normal Form (2NF)
- A relation must be in first normal form and relation must not contain any partial dependency.
- A relation is in 2NF if it has No Partial Dependency, i.e., no non-prime attribute (attributes which are not part of any candidate key) is dependent on any proper subset of any candidate key of the table.
Functional Dependency
- Functional dependency in DBMS, as the name suggests is a relationship between attributes of a table dependent on each other.
- It helps in preventing data redundancy.
- Functional Dependency is represented by -> (arrow sign)
Third Normal Form (3NF)
- It should be in the Second Normal form.
- And it should not have Transitive Dependency.
Transitive Dependency
- When a non-prime attribute depends on other non-prime attributes rather than depending upon the prime attributes or primary key, this is called Transitive Dependency.
- A functional dependency is said to be transitive if it is indirectly formed by two functional dependencies. For e.g.
X -> Z is a transitive dependency if the following three functional dependencies hold true:
- X->Y
- Y does not ->X
- Y->Z
Note: A transitive dependency can only occur in a relation of three or more attributes. This dependency helps us normalizing the database in 3NF (3rd Normal Form).
The advantage of removing transitive dependency is,
- Amount of data duplication is reduced.
- Data integrity achieved.
Boyce-Codd Normal Form (BCNF)
For a table to satisfy the Boyce-Codd Normal Form, it should satisfy the following two conditions:
- It should be in the Third Normal Form.
- And, for any dependency A → B, A should be a super key.
Fourth Normal Form (4NF)
For a table to satisfy the Fourth Normal Form, it should satisfy the following two conditions:
- It should be in the Boyce-Codd Normal Form.
- And, the table should not have any Multi-valued Dependency.
Multi-valued Dependency
A table is said to have a multi-valued dependency if the following conditions are true,
- For a dependency A → B, if for a single value of A, multiple values of B exists, then the table may have a multi-valued dependency.
- Also, a table should have at least 3 columns for it to have a multi-valued dependency.
- And, for a relation
R(A,B,C)
, if there is a multi-valued dependency between, A and B, then B and C should be independent of each other.
If all these conditions are true for any relation(table), it is said to have a multi-valued dependency.
Fifth normal form (5NF)- A relation is in 5NF if it is in 4NF and not contains any join dependency and joining should be lossless.
- 5NF is satisfied when all the tables are broken into as many tables as possible in order to avoid redundancy.
- 5NF is also known as Project-join normal form (PJNF).
- A relation is in 5NF if it is in 4NF and not contains any join dependency and joining should be lossless.
- 5NF is satisfied when all the tables are broken into as many tables as possible in order to avoid redundancy.
- 5NF is also known as Project-join normal form (PJNF).
No comments:
Post a Comment