Professional Documents
Culture Documents
Normalization
Normalization
Removing anomaly
ProductID Product
1 Keyboard
2 Mouse
3 Laser Pointer OrderID ProductID Price Quantity
4 SD Card 100 1 1000 1
5 HDMI 100 2 500 1
100 5 200 1
OrderID Customer Address City 101 3 1400 1
100 Ali Khan 14-D, Gulberg Lahore 101 2 500 2 (Re
101 Asim Ali 27-N, DHA Lahore 102 1 1000 2 mov
102 Babur Awan 33 Defence Karachi 103 4 800 1 ed
103 3 1400 1 the
103 Zubair Haider 14, Sector P Islamabad
repe
ating groups. Now there is no redundancy and all fields are atomic.)
(Moved the attribute that was partially dependent on the composite key.)
OrderID ProductID Quantity
3NF (Third Normal Form) 100 1 1
100 2 1
ProductID Product Price
100 5 1
1 Keyboard 1000
101 3 1
2 Mouse 500
101 2 2
3 Laser Pointer 200
103 1 2
4 SD Card 1400
104 4 1
5 HDMI 500
104 3 1
OrderID Customer Address CityID CityID City
100 Ali Khan 14-D, Gulberg 1 1 Lahore
101 Asim Ali 27-N, DHA 1 2 Karachi
102 Babur Awan 33 Defence 2 3 Islamabad
103 Zubair Haider 14, Sector P 3 4 Peshawar
5 Quetta
0NF/UNF
No organization of data.
There are repeating groups.
There is redundancy.
1NF
There are no repeating groups.
Every attribute must be atomic.
There must be no repeating attributes.
There must be no empty Key Field values.
2NF
The database must be in the First Normal Form.
There must not be any partial dependencies.
(All non-prime attributes must be fully dependent on the entire Key Attributes).
3NF
The database must be in the Second Normal Form.
There must not be any indirect dependencies.
(No transitive dependencies).
Definitions: Keys
Primary Key
An attribute that uniquely identifies a tuple within a relation.
Non-Prime Attribute
Any attribute other than the primary key or part of primary key pair.
Non-Key Attribute
Any attribute that can not be a candidate key.
(It must depend directly on the key attribute(s))
Foreign Key
An attribute in one relation that references a primary key in another relation.
Composite Key
Two or more attributes used together to uniquely identify a tuple within a relation.
(An attribute that is part of a composite key must not be able to identify a tuple on its own.)