Normalization Extra
Normalization Extra
1 2
1
Before Normalization Before Normalization – Example
1. Begin with a list of all the fields that must
appear in the database. Think of this as one
big table.
2. Do not include computed fields
3. One place to begin getting this information
is from a printed document used by the
system.
4. Additional attributes besides those for the
entities described on the document can be Fields in the original data table will be as follows (Think of this as the baseline – one large table)
SalesOrderNo, Date, CustomerNo, CustomerName, CustomerAdd, ClerkNo, ClerkName,
added to the database. ItemNo, Description, Qty, UnitPrice
5 6
7 8
2
First Normal Form (1NF) QA Normalization: Second Normal Form (2NF)
Questions: What if we did not normalize the • Remove Partial Dependencies.
Database to First Normal Form? • Functional Dependency: The value of one attribute
in a table is determined entirely by the value of
Answer: Repetition of Data – So, Header data another.
(customer no., customer name, customer • Partial Dependency: A type of functional dependency
address, etc) is repeated for every line in where an attribute is functionally dependent on only
sales order. part of the primary key (primary key must be a
composite key).
• Create separate table with the functionally
dependent data and the part of the key on which it
depends. Tables created at this step will usually
contain descriptions of resources.
9 10
3
Normalization: Third Normal Form (3NF) Third Normal Form Example
• The new tables would be:
• Remove transitive dependencies.
CustomerNo, CustomerName, CustomerAdd
• Transitive Dependency: A type of functional
ClerkNo, ClerkName
dependency where an attribute is functionally
dependent on an attribute other than the primary • All of these fields except the primary key will be
removed from the original table. The primary key
key. Thus its value is only indirectly determined by will be left in the original table to allow linking of
the primary key. data as follows:
• Create a separate table containing the attribute and SalesOrderNo, Date, CustomerNo, ClerkNo
the fields that are functionally dependent on it. • Together with the unchanged tables below, these
Tables created at this step will usually contain tables make up the database in third normal form.
descriptions of either resources or agents. Keep a ItemNo, Description
copy of the key attribute in the original file. SalesOrderNo, ItemNo, Qty, UnitPrice
13 14
15 16
4
Exercise: Normalize …
17