Professional Documents
Culture Documents
What Is Normalizationbykbs
What Is Normalizationbykbs
What is Normalization?
Normalization is a formal process for determining which fields
belong in which tables in a relational database.
Through normalization a collection of data in a record structure is
replaced by successive record structures that are simpler and
more predictable and therefore more manageable.
Design Vs Implementation
Designing a database structure and implementing a database structure
are different tasks.
Terminology
Primary Key
[Companies]
Company Name
Address
[People]
Social Security Number
First Name
Last Name
Date of birth
In the United States all workers have a Social Security Number that
uniquely identifies them for tax purposes. Or does it? As it turns out,
not everyone has a Social Security Number, some people’s Social
Security Numbers change, and some people have more than one. This
is an appealing but untrustworthy key.
Functional Dependency
[ZIP Codes]
ZIP Code
City
County
State Abbreviation
State Name
What’s wrong with this approach? Well, what happens when you have a
fourth contact? You have to add a new field, modify your forms, and
rebuild your routines. What happens when you want to query or report
based on all contacts across all customers? It takes a lot of custom
code, and may prove too difficult in practice. The structure we’ve just
shown makes perfect sense in a spreadsheet, but almost no sense in a
relational database. All of the difficulties we’ve described are resolved
by moving contacts into a related table.
[Customers]
Customer ID
Customer Name
[Contacts]
Customer ID (this field relates [Contacts] and [Customers])
Contact ID
Contact Name
The second normal form helps identify when you’ve combined two
tables into one. Second normal form depends on the concepts of the
primary key, and functional dependency. The second normal form is:
To test whether a 2NF table is also in 3NF, we ask, “Are any of the
non-key columns dependent on any other non-key columns?
Chris Gane
Computer Aided Software Engineering
[ZIP Codes]
ZIP Code
City
County
State Abbreviation
[States]
State Abbreviation
State Name
There are several higher normal forms, including 4NF, 5NF, BCNF, and
PJ/NF. We’ll leave our discussion at 3NF, which is adequate for most
practical needs. If you are interested in higher normal forms, consult a
book like Date’s An Introduction to Database Systems.
Illustrations
Before Normalization
Order Cust. Cust. Name Address Order Item Item Item Price Qty. Total
Numbe Numbe Date No. Description Order Cost
r r
101426 AK100 Arun Kumar 25, Car St., 20/04/09 TA100 Table Clothes 270.00 100 27000
Triplicane, Chennai.
102356 SU100 Sukumaran 16, Rajaji St, 03/05/09 BL200 Blankets 300.00 10 6450
Chennai CU200 Curtains-
Window 150.00 5
TA100 Table Clothes 270.00 10
102569 SW100 Swarna & Co. 27, Garden St, 07/06/09 BL200 Blankets 300.00 5 7500
Chennai – 34 CU100 Curtains-
Window 150.00 5
SP200 Spreadsheet 350.00 10
TA100 Table Clothes 270.00 5
102589 ET100 Ethiraj 20,Dowing Street, 19/07/09 BL200 Blankets 300.00 10 7600
Chennai CU100 Curtains-
Window 150.00 10
SP200 Spreadsheet 350.00 5
TA100 Table Clothes 270.00 5
This table is before normalization i.e., this table will not be flexible and easy to use. The Items are redundant. They appear
several times. This will lead to confusion. Moreover for each and every order number, we have to enter customer details
which is very cumbersome process. There will be problem in modifying the customer details and item details later on. This
table is highly unorganized. So, we have to split this table in to small tables to facilitate the processing. This call for using
Normalization.
First Normalization
1. Remove all repeating groups so that the record will be in fixed
length. In the above case for one order number, several Item
details are there.
Order Record
Now each record is fixed in length and does not contain any repeating groups
NATION_NAME
NATION_VN
SPEC_NO
SPEC_NAME
COLL _NO
COLL _NAME
Secondly, we normalize the reader table with its attributes and have this table:
DEPT_NO
DEPT_NAME
RETURN_DATE RETURN_DATE
READER_NAME READER_NAME
BOOK_NO BOOK_NO
BOOK_NAME BOOK_NAME
And then, the magazine table, we realize that, the list of attributes has a
repeating group, it includes these attributes: MAG_HEAD_NO, MAG_NAME,
START_YEAR, MAG_SHEFL, ISSN_NO, PUB_HOUSE, LANG_NO,
LANG_NAME, LANG_VN, LANG_SYS, NATION_NO, NATION_NAME,
NATION_VN, SPEC_NO, SPEC_NAME, COLL_NO, COLL_NAME, and
COMMENT, so we decompose it into a new table with a primary key:
MAG_HEAD_NO without data loss. The remaining attributes (MAG_HEAD_NO,
MAG_DETL_NO, YEAR, VOLUME, NUMBER, MONTH, QUANTITY) are put in
another table with a primary key including 2 attributes: MAG_HEAD_NO,
MAG_DETL_NO. And we have the below table:
YEAR NATION_NAME
MAG_HEAD_NO
MAG_DETL_NO
YEAR
VOLUME
NUMBER
MONTH
QUANTITY
.
.
.