Normal Form in MySQL
Hello everyone,
previous article we learned Normalization and its advantages and disadvantages.
In this article, we will learn Normal Form. Let’s go.
There
are six normal forms available in MySQL.
1.
1st
Normal Form (1NF)
2.
2nd
Normal Form (2NF)
3.
3rd
Normal Form (3NF)
4.
Boyce-Codd
Normal Form (BCNF)
5.
4th
Normal Form (4NF)
6.
5th
Normal Form (5NF)
C# basic course click on: https://www.udemy.com/learn-csharp-with-sagar-jaybhay/
Web API 2-
.Net Core In depth In 5 Hours click on: https://www.udemy.com/web-api-2-net-core-in-depth-in-5-hrs-with-sagar-jaybhay/
1.
1st
Normal Form (1NF)
In
First Normal Form (1NF) should have only single-valued attributes or each table
cell should contain a single value. Each column needs to be unique records in
first normal form.
For
example: following fruits table 1 there is no First Normal Form (1NF) because
of a multi-valued attribute in the fruits_names column.
Fruits
Table 1:
No
|
fruits_colours
|
fruits_names
|
1
|
Red
|
Strawberries,
Cherries, Apple
|
2
|
Yellow
|
Mango,
Orange
|
3
|
Green
|
Kiwi
|
Fruits
Table 2: following fruits table 2 there is first normal form because each cell
has single values.
No
|
fruits_colours
|
fruits_names
|
1
|
Red
|
Strawberries
|
1
|
Red
|
Cherries
|
1
|
Red
|
Apple
|
2
|
Yellow
|
Mango
|
2
|
Yellow
|
Orange
|
3
|
Green
|
Kiwi
|
2.
2nd
Normal Form (2NF)
A
Second Normal Form (2NF) it should be in the First Normal Form (1NF) and
relation must not contain any partial dependency.
Fruit
Information Table 1:
FINo
|
fruits_colours
|
fruits_names
|
1
|
Red
|
Strawberries
|
2
|
Red
|
Cherries
|
3
|
Yellow
|
Mango
|
4
|
Green
|
Kiwi
|
Fruit
Color Category Table 2:
FINo
|
fruits_colours
|
1
|
Red
|
2
|
Yellow
|
3
|
Green
|
Fruit
Name Table 3:
FNNo
|
fruits_names
|
1
|
Strawberries
|
2
|
Cherries
|
3
|
Mango
|
4
|
Kiwi
|
Fruit
Table 4:
FNo
|
FINo
|
FNNo
|
1
|
1
|
1
|
2
|
1
|
2
|
3
|
2
|
3
|
4
|
3
|
4
|
3.
3rd
Normal Form (3NF)
A
Third Normal Form (3NF) it should be in the Second Normal Form (2NF) and it has
no Transitive Dependency.
4.
Boyce-Codd
Normal Form (BCNF)
Third
Normal Form (3NF) higher version is Boyce-Codd Normal Form (BCNF) and relation
R must be in Third Normal Form (3NF). Boyce-Codd Normal Form (BCNF) for each
functional dependency (x à y) x should be a super key. Boyce-Codd
Normal Form (BCNF) is free from redundancy and if a relation is in Boyce-Codd
Normal Form (BCNF), then Third Normal Form (3NF) is also satisfied.
C# basic course click on: https://www.udemy.com/learn-csharp-with-sagar-jaybhay/
Web API 2-
.Net Core In depth In 5 Hours click on: https://www.udemy.com/web-api-2-net-core-in-depth-in-5-hrs-with-sagar-jaybhay/
5.
4th
Normal Form (4NF)
A
Fourth Normal Form (4NF) it should be in the Boyce-Codd Normal Form (BCNF) and
Fourth Normal Form (4NF) tables don’t have Multi-Valued Dependencies on a
Primary Key.
6.
5th
Normal Form (5NF)
A
relation R is in Fifth Normal Form (5NF) if it is in Fourth Normal Form (4NF)
and not contains any join dependency. Fifth Normal Form (5NF) can’t be further
non-loss decomposed (join dependency).
So this is all
about Normalizations six Normal Forms.
Comments
Post a Comment