Documente Academic
Documente Profesional
Documente Cultură
TJ Racoosin
2 Dec 1998
CPCUG Access SIG
Racoosin Solutions
Why Normalize?
• Flexibility
– Structure supports many ways to look at the data
• Data Integrity
– “Modification Anomalies”
• Deletion
• Insertion
• Update
• Efficiency
– Eliminate redundant data and save space
Racoosin Solutions
Normalization Defined
• “ In relational database design, the process of
organizing data to minimize duplication.
• Normalization usually involves dividing a
database into two or more tables and defining
relationships between the tables.
• The objective is to isolate data so that additions,
deletions, and modifications of a field can be made
in just one table and then propagated through the
rest of the database via the defined relationships.”
- Webopedia, http://webopedia.internet.com/TERM/n/normalization.html
Racoosin Solutions
Another Definition
• "Normalization" refers to the process of
creating an efficient, reliable, flexible,
and appropriate "relational" structure for
storing information. Normalized data
must be in a "relational" data structure.
- Reid Software Development,
http://www.accessdatabase.com/normalize.html
Racoosin Solutions
The Normal Forms
• A series of logical steps to take to
normalize data tables
• First Normal Form
• Second
• Third
• Boyce Codd
• There’s more, but beyond scope of
this
Racoosin Solutions
First Normal Form (1NF)
• All columns (fields) must be atomic
– Means : no repeating items in columns
OrderDate Customer Items
11/30/1998 Joe Smith Hammer, Saw, Nails
OrderDate Customer Item1 Item2 Item3
11/30/1998 Joe Smith Hammer Saw Nails
Solution: make a separate table for each set of
attributes with a primary key (parser, append query)
Customers Orders
CustomerID OrderID
Name Item
CustomerID
OrderDate Racoosin Solutions
Second Normal Form (2NF)
• In 1NF and every non-key column is fully
dependent on the (entire) primary key
– Means : Do(es) the key field(s) imply the rest of the fields? Do we
need to know both OrderID and Item to know the Customer and
Date? Clue: repeating fields
OrderID Item CustomerID OrderDate
1 Hammer 1 11/30/1998
1 Saw 1 11/30/1998
1 Nails 1 11/30/1998
Racoosin Solutions
Relationships
• One to many to enforce “Referential Integrity”
Two “foreign”
keys make a
A look up table - it
composite primary
doesn’t reference
key and “relate”
any others
many to many
tables
Racoosin Solutions
Table Prefixes Aid Development
– First, we’ll get replace text PK with number
– The Items table is a “look up” with tlkp prefix
– tlkp “lookup” table (no “foreign keys”)
– OrderDetails is renamed “trelOrderItem” a
“relational” table
• trel “relational” (or junction or linking)
– two foreign keys make a primary
OrderDetails
OrderID
Item trelOrderItem tblOrders
tlkpItems OrderID
OrderID
ItemID CustomerID
ItemID
ItemName OrderDate
Racoosin Solutions
Referential Integrity
• Every piece of “foreign” key data has a
primary key on the one site of the relationship
– No “orphan” records. Every child has a parent
– Can’t delete records from primary table if in related table
Racoosin Solutions
When Not to Normalize
• Want to keep tables simple so user can make
their own queries
– Avoid processing multiple tables
• Archiving Records
– If No need to perform complex queries or “resurrect”
– Flatten and store in one or more tables
• Testing shows Normalization has poorer
performance
– “Sounds Like” field example
– Can also try temp tables produced from Make Table queries
Racoosin Solutions
Real World - School Data
Student Student Previous Current
Last First Parent 1 Parent 2 Teacher Teacher
Smith Renee Ann Jones Theodore Smith Hamil Burke
Mills Lucy Barbara Mills Steve Mills Hamil Burke
Jones Brendan Jennifer Jones Stephen Jones Hamil Burke ….
Street Address City State Postal Code Home Phone
5551 Private Hill Annandale Virginia 22003- (703) 323-0893
4902 Acme Ct Annandale Virginia 22003- (703) 764-5829
5304 Gains Street Fairfax Virginia 22032- (703) 978-1083 ….
Racoosin Solutions
One Possible Design
Racoosin Solutions
Books
• Access97 Developers Handbook Litwin,Getz & Gilbert
– Chapter 4
• Access and SQL Server Developers Handbook
Viescas, Gunderloy and Chipman
– Chapter 2
• Access97 Expert Solutions Lezynski
– Chapter 10
Racoosin Solutions
Internet
• Papers
• http://www.mtjeff.com/~calvin/devhbook/databasedesign.html
• http://www.swin.edu.au/infotech/subjects/bt220/bt220s1.html
• http://www.bus.okstate.edu/lhammer/AISweb/Normaliz.htm
http://www.inetspace.com/database.html
• Slides
• http://www.mgt.buffalo.edu/courses/mgs/404/mfc/lecture4.ppt
• http://www.state.sd.us/people/colink/datanorm.htm
• http://www.cba.nau.edu/morgan-j/class/subtop2_3/sld001.htm
Racoosin Solutions