0% found this document useful (0 votes)
10 views

DBS211_Lab10_Normalization2

Uploaded by

shahmdtakrim4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

DBS211_Lab10_Normalization2

Uploaded by

shahmdtakrim4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

DBS211

Lab 10 – Normalization 2
(2NF, 3NF)
Objective:
Students will learn:
 To continue the normalization of user views from 1NF to 2NF and 3NF
 How to identify and remove partial dependencies
 How to identify and remove transitive dependencies

Submission:
Save your lab file as a PDF file. You need to submit a single PDF
named as DBS211_L10_Group_Number file for this lab.
Your name and student ID MUST be in the PDF file or you will
receive a mark of zero.

Definitions:
Definition: A relation is in 1NF if it contains no multi-valued dependencies (also
known as repeating groups).
Definition: A relation is in 2NF it is in 1NF and it contains no Partial Dependencies.
Definition: A Partial Dependency occurs when a non-key attribute(s) is dependent
on (or is determined by) a part of a composite primary key.
Definition: A relation is in 3NF it is in 2NF and it contains no Transitive
Dependencies.
Definition: A Transitive Dependency occurs when a non-key attribute (s) is
dependent on (or is determined by) another non-key attribute.

Instructions:
Part A (Second Normal Form (2NF))
DBS211

Note: A relation that has only a simple primary key cannot have any partial
dependencies!

1. Examine the following report:

Premiere Corporation
Customer Orders
Customer Name Order Order Date Sales Rep Rep Last
Number Number Name
124 Sally Adams 12489 2016-09-02 03 Jones
12500 2016-09-05
256 Ann Samuels 12495 2016-09-04 06 Smith
311 Don Charles 12491 2016-09-02 12 Diaz
315 Tom Daniels 12494 2016-09-04 06 Smith
522 Mary Nelson 12498 2016-09-05 12 Diaz
12504 2016-09-05

Step 1:
Create the UNF relation by creating a relation composed of all the attributes found
in the User View. Don’t forget to underline the primary key and place brackets
around any multi-valued dependencies (also known as repeating groups) you may
find.

UNF:

UNF: Customer [ CustNo, CustName, RepNo, RepName, (OrderNo,


OrderDate) ]

_____________________________________________________________________________________
_______

Step 2:
Create the 1NF relations by resolving the multi-valued dependencies (also known as
repeating groups):

1NF
Now you are ready to create the 2NF relations by resolving the partial
dependencies from the 1NF relations.

Your 1NF solution should look something like this:

1NF: Customer [ CustNo, CustName, RepNo, RepName ]


Cust_Order [ CustNo, OrderNo, OrderDate ]

Note: if you did not get a similar solution, please talk to your instructor about it
now! It is very important to get the correct UNF and 1NF relations.
DBS211

Step 3:
The process for taking a relation from 1NF to 2NF involves resolving the partial
dependencies. We see that from our definition of 2NF (page 1) a partial Dependency
is when a non-key attribute is determined by a part of the primary key. We also
read in the note (page 1) that we cannot have partial dependencies when there is a
one-part Primary Key).

1NF: Customer [ CustNo, CustName, RepNo, RepName ]


Cust_Order [CustNo, OrderNo, OrderDate ]

Now examine the Cust_Order relation. Does it have a composite primary key ( a
key made up of more than 1 field) ? ____________

Identify the key attributes._________________________________

Identify the non-key attributes. _____________________________

Are any of the non-key attributes determined by ONE of the key attributes?
_______________________

Which non-key attributes are determined by only one of the PK attributes?


________________________________________.

We must create new relations for the partial dependencies.

Write the 3 possible PK’s:

[CustNo ,
[OrderNo ,
[CustNo, OrderNo ,

Place all non-key attributes on the appropriate table (hint: choose the table with the
least parts.

2NF:
CUSTOMER [ CustNo,
ORDER [ OrderNo
CUSTORDER [ CustNo, OrderNo,

1NF: Customer [ CustNo, CustName, RepNo, RepName ]


Cust_Order [CustNo, OrderNo, OrderDate ]

Part B (Third Normal Form (3NF))


DBS211

We now have a set of 2NF relations from our User View. Your 2NF solution should
look something like this:

2NF:
Customer [ CustNo, CustName, RepNo, RepName ]
CustOrder [ CustNo, OrderNo ]
Order [ OrderNo, Orderdate ]

If you did not correctly identify the order relation, please ask your instructor about
this process now!

We are now ready to identify any transitive dependencies we may have.

Note: A relation that has no transitive dependencies is already in 3NF!

1. Examine each of the 2NF relations and determine the following:

Customer relation: Key attributes ___________________________________

Non-key attributes: ________________________________

CustOrder relationKey attributes ___________________________________

Non-key attributes ___________________________________

Order relation Key attributes ____________________________________

Non-key attributes: ___________________________________

Note: if a relation contains less than 2 non-key attributes, there cannot be any
transitive dependencies. Therefore the CustOrder and Order relations cannot
contain any transitive dependencies! Simply copy those relations to the 3NF
solution.

Examine non-key attributes of the Customer relation. Do any of the non-key


attributes determine any of the other non-key attributes? __________
If you answered yes, you are right. Fill in the blanks:

____________________________ is determined by ________________

2. We must create a new relation for the transitive dependency. We do this by


moving the non-key attributes involved in the transitive dependency to a new
relation. The primary key of the new relation will be the non-key attribute
that determines the other non-key attributes involved in the transitive
dependency.

Write the DBDL for the new relation:


DBS211

REP [ ]

3. The last step in resolving the transitive dependency is to maintain the link (or
relationship) between the relation that contained the transitive dependency
(Customer) and the new relation (Rep). We do this by placing a foreign key
to the new relation (Rep) into the relation that contained the transitive
dependency (Customer). The foreign key will be the primary key of the new
relation. Don’t forget to identify it with (FK)

Complete the 3NF solution:

3NF:

CUSTORDER [ CustNo, OrderNo ]


ORDER [ OrderNo, Orderdate ]
CUSTOMER [CustNo, CustName, ] (fill in the foreign key)
REP [ ]

3NF: Customer [ CustNo, CustName, FK RepNo ]


Cust_Order [ OrderNo, OrderDate, FK CustNo ]
Reps [ RepNo, RepName ]
DBS211

Lab 9 Submission:

For the following User View, determine the 1, 2 and 3NF and hand in this
page to your instructor. The UNF relation has been provided.

Premiere Corporation
Order Detail Report

Order Order Date Cust Cust Last Part Part Qnty Quoted
Numb Number Name Number Desc Ordered Price
er
12489 2016-09-02 124 Adams AX12 Iron 11 14.95
124
12491 2016-09-02 311 Charles BT04 GasGrill 3 440.00
311 BZ66 Washer 1 399.99
CX11 MiniBlende 1 11.98
r
12494 2016-09-04 315 Daniels CB03 Bike 4 279.96
12495 2016-09-04 256 Samuels CX11 MiniBlende 2 23.96
r
12498 2016-09-05 522 Nelson AZ52 Dartboard 2 12.96
BA74 Basketbal 4 24.96
12500 2016-09-05 124 Adams BT04 GasGrill 1 149.99
12504 2016-09-05 522 Nelson CZ81 Treadmill 2 325.98

UNF:
Order [ OrderNo, Orderdate, CustNo, CustLname, (PartNo, PartDesc, QtyOrd, Price)]

1NF:

2NF:

3NF:

You might also like