Home  |  FAQ  |  About  |  Contact  |  View Source   
 
SEARCH:
 
BROWSE:
    My Hood
Edit My Info
View Events
Read Tutorials
Training Modules
View Presentations
Download Tools
Scan News
Get Jobs
Message Forums
School Forums
Member Directory
   
CONTRIBUTE:
    Sign me up!
Post an Event
Submit Tutorials
Upload Tools
Link News
Post Jobs
   
   
Home >  Tutorials >  Database >  Database Normalization
Add to MyHood
   Database Normalization   [ printer friendly ]
Stats
  Rating: 4.22 out of 5 by 18 users
  Submitted: 12/05/01
Greg Hendricks ()

 
Database Normalization Part 1

When creating a database, it is often useful to learn from the mistakes of
others. Within the Relational Database Model, a set of rules has been established
to aid in the design of tables that are meant to be connected through relationships.
This set of rules is known as Normalization.


In this Tutorial we will address the first of five normal forms, and
the ways in which normalizing your database will help prevent problems as you
add to it.


The concept of database normalization is not unique to any particular Relational
Database Management System. It can be applied to any of several implications
of relational databases including Microsoft Access, dBase, Oracle, etc. The
benefits of Normalizing your database include:


  • Avoiding repetitive entries</li>
  • Reducing required storage space</li>
  • Preventing the need to restructure existing tables to accommodate new data.</li>
  • Increased speed and flexibility of queries, sorts, and summaries.</li>

There are five normal forms in all, each progressively building on its predecessor.
In order to reach peak efficiency, it is recommended that relational databases
be normalized through at least the third normal form. In order to normalize
a database, each table should have a primary key field that uniquely identifies
each record in that table. A primary key can consist of a single field (an ID
Number field for instance) or a combination of two or more fields that together
make a unique key (called a multiple field primary key).


The First Normal Form

For a table to be in first normal form, data must be broken up into the smallest
units possible. For example, the following table is not in first normal form.


Name Address Phone
Sally Singer 123 Broadway New York, NY, 11234 (111) 222-3345
Jason Jumper 456 Jolly Jumper St. Trenton NJ, 11547 (222) 334-5566

To conform to first normal form, this table would require additional fields.
The name field should be divided into first and last name and the address should
be divided by street, city state, and zip like this.


ID First Last Street City State Zip Phone
564 Sally Singer 123 Broadway New York NY 11234 (111) 222-3345
565 Jason Jumper 456 Jolly Jumper St. Trenton NJ 11547 (222) 334-5566

In addition to breaking data up into the smallest meaningful values, tables
in first normal form should not contain repetitions groups of fields such as
in the following table.


Rep ID Representative Client 1 Time 1 Client 2 Time 2 Client 3 Time 3
TS-89 Gilroy Gladstone US Corp. 14 hrs Taggarts 26 hrs Kilroy Inc. 9 hrs
RK-56 Mary Mayhem Italiana 67 hrs Linkers 2 hrs    

The problem here is that each representative can have multiple clients not
all will have three. Some may have less as is the case in the second record,
tying up storage space in your database that is not being used, and some may
have more, in which case there are not enough fields. The solution to this is
to add a record for each new piece of information.


Rep ID Rep First Name Rep Last Name Client Time With Client
TS-89 Gilroy Gladstone US Corp 14 hrs
TS-89 Gilroy Gladstone Taggarts 26 hrs
TS-89 Gilroy Gladstone Kilroy Inc. 9 hrs
RK-56 Mary Mayhem Italiana 67 hrs
RK-56 Mary Mayhem Linkers 2 hrs

Notice the splitting of the first and last name fields again.


This table is now in first normal form. Note that by avoiding repeating groups
of fields, we have created a new problem in that there are identical values
in the primary key field, violating the rules of the primary key. In order to
remedy this, we need to have some other way of identifying each record. This
can be done with the creation of a new key called client ID.


Rep ID* Rep First Name Rep Last Name Client ID* Client Time With Client
TS-89 Gilroy Gladstone 978 US Corp 14 hrs
TS-89 Gilroy Gladstone 665 Taggarts 26 hrs
TS-89 Gilroy Gladstone 782 Kilroy Inc. 9 hrs
RK-56 Mary Mayhem 221 Italiana 67 hrs
RK-56 Mary Mayhem 982 Linkers 2 hrs

This new field can now be used in conjunction with the Rep ID field to create
a multiple field primary key. This will prevent confusion if ever more than
one Representative were to serve a single client.


This now sets us up for our next installment, the second and third normal forms.


 




Return to Browsing Tutorials

Email this Tutorial to a Friend

Rate this Content:  
low quality  1 2 3 4 5  high quality

Reader's Comments Post a Comment
 
This is a good topic to write about. I haven't seen many tutorials for this out there... and I've seen a lot of poorly designed databases.

Can you combine the 5 forms into one tutorial?.... this is pretty short..
-- Andrew Ma, December 10, 2001
 
That was a nice and simple read. I'm impressed a CS person could rit lik dat!
DD
-- David Doucette, December 11, 2001
 
nice work
-- Vijay Venkatachalam, December 11, 2001
 
what about the 4th & 5th normal form ?
-- Smith Green, December 11, 2001
 
Nice and concise
-- Antoine Lourtau, December 15, 2001
 
This is what i learned in my IS class and this tutorial helps a lot.
-- Yusno Yunos, December 20, 2001
 
This is easy to read and understand. The example helps a lot in the understanding.
-- Vincent Chan, January 15, 2002
 
Nice clear example and I'd like to see more.
-- Wayne Kao, January 17, 2002
 
Concise and brief. Nice example too.
-- William Chu, January 18, 2002
 
Interesting stuff!
-- Gary Lo, January 29, 2002
 
Neat one
-- Krishnan Subramanian, January 29, 2002
 
Brought up a good idea. nice work !
-- Lucky Rumengan, February 07, 2002
 
Very nice job, it was direct, concise and easy to read. I look forward to reading more about this topic.
-- Amha Mogus, February 21, 2002
 
Very nice job, it was direct, concise and easy to read. I look forward to reading more about this topic.
-- Amha Mogus, February 21, 2002
 
Question:

"The problem here is that each representative can have multiple clients not
all will have three. Some may have less as is the case in the second record,
tying up storage space in your database that is not being used, and some may
have more, in which case there are not enough fields. The solution to this is
to add a record for each new piece of information."

Well I mean okay, so if say you only use 2 of the clients, and you waste one, but then you're making 2 of the user with a client, so now you're generating your first name and last name again. Wouldn't that be considered wasteful?
-- Victor Vuong, March 01, 2002
 
Good tutorial.
-- Brian Simoneau, March 04, 2002
 
5 Stars *****

Great job! This is exactly what I was looking for. I've been working on some normalization exercises for some time and needed some additional clarification.
-- Ammon Beckstrom, March 11, 2002
 
you did a great job, i gave you a 5
-- Brian Gall, March 12, 2002
 
Well done! ****
-- Sean Fitzgerald, March 14, 2002
 
Good content, but I agree with earlier posts that it could have been combined with a discussion of other normal forms.
-- parker thompson, April 30, 2002
 
simple and concise ... nice!
-- Edward Kim, May 29, 2002
 
It's really informative..Good job!
-- Janak Mehta, October 01, 2002
 
Copyright © 2001 DevHood® All Rights Reserved