Sei sulla pagina 1di 2

BTD210

Normalization Exercise

Objective and Purpose: Your task in this exercise is to move the un-normalized table to 3NF. To do this,
use the dependency diagram to identify partial dependencies and transitive dependencies.

Department Complaints
Important Assumptions
Assume that the dept# and cust# are needed to uniquely identify the date and nature of the complaint about the
department.

Un-normalized Table
Dept# DeptNam Location MgrNam MgrID TelExtn Cust# CustNam Date of Nature of
e e e Complain Complaint
t
11232 Soap Cincinnat Mary S11 7711 P10451 Robert 1/12/1998 Poor Service
Division i Samuel Drumtree
P10480 Steven 1/14/1998 Discourteous
Parks Attendant

Step 1: Convert from UNF to 1NF


When moving from an unnormalized table to 1NF, take out the repeating groups. One approach is to fill the empty
cells. A second is to split out the repeating elements into a new table. You will therefore move from 1 table to 2
tables one table contains the attributes that do not repeat, together with the PK that determines them, and the
second table contains the attributes that DO repeat, with the combined PK that determines them.

Dept# DeptName Location MgrName MgrID TelExtn

Dept# Cust# CustNam Date of Nature of


e Complain Complaint
t

1NF (remove partial dependencies)


Dept# Deptname, location, mgrname, mgrID, telextn

Dept#,Cust# custname, dateofcomplaint, natureofcomplaint

The process of normalization is a process of decomposition. We start with one table, and
because there are repeating groups in this table, we decompose the original table to
produce two tables. Our first table is made up of the attributes that do not repeat in this
relationship matched with the PK that determines them. Our second table is comprised of
those attributes that can appear more that once matched with a combined PK that is needed
to determine the value of these attributes.

Step2: Identify Dependencies(use tables above)


Draw lines showing the dependencies between each attribute.

Dept# DeptName Location MgrName MgrID TelExtn


Dept# Cust# CustNam Date of Nature of
e Complain Complaint
t
Step 3: Convert 1NF to 2NF:
To move a table from 1NF to 2NF, remove partial dependencies.

Dept# Deptname, location, mgrname, mgrID, telextn

Dept#,Cust# dateofcomplaint, natureofcomplaint

Cust# custname (created because a partial dependency was identified)

You will only find partial dependencies in tables that have a combined or concatenated
primary key. One table in 1NF had a combined PK, and on review, you should be able to
determine that the cust# alone can determine the customer name; you dont need to know
anything about the department. However, you need to know both the department and
customer to determine the date and nature of the complaint. With partial dependencies,
you are seeking to create a relationship (table) that utilizes only part of an existing PK.

Step 4: Convert from 2NF to 3NF


To move a table from 2NF to 3NF, remove the transitive dependencies

Mgrid mgrname (created because a transitive dependency was recognized)

Dept# Deptname, location, mgrID, telextn

Dept#,Cust# dateofcomplaint, natureofcomplaint

Cust# custname

Transitive dependencies occur when there is an attribute other than the chosen PK that can
uniquely identify the value of another attribute in the table. In this example, and looking at
the 2NF values, it should be fairly obvious that that managerid determines the value of the
manager name, and that one should not need to access information about a department to
determine the managers name. With transitive dependencies, you are seeking to create a
table that makes a non-key attribute of one table the PK of another, new table.

NOTE: While this is not a difficult example, and creating the tables in 3NF is fairly straight
forward, it is beneficial that you go through normalization in an orderly fashion. Become
familiar with the steps of normalization that take you from UNF through 1NF to 2NF to 3NF.

Potrebbero piacerti anche