$29.99
(UNF, 1NF) Objective:
• Students create the Un-normalized Form (UNF) relation from a user view. • Students identify a Multi-valued Dependency (a.k.a. Repeating Group )
• Students create the First Normal Form (1NF) relation from the UNF.
Submission:
Only submit the last section, however it is extremely important that you you’re your way through it first.
Save your lab file as a PDF file. You need to submit a single PDF file for this lab.
YOUR NAME AND Oracle ID MUST BE IN THE PDF document or you will receive a mark of ZERO.
The name of the file must be as follow:
L09_UserID_LASTNAME.pdf
Definitions:
Definition: Normalization is the process of assigning attributes to relations in such a way that data redundancies are reduced or eliminated.
Definition: User Views can be individual descriptions, reports, forms, or lists of data that are required to support the operations of a particular database user.
Definition: Unnormalized form (UNF) is a relation that contains one or more Multi-valued Dependencies.
Definition: A Multi-valued Dependency is an attribute or collection of attributes within a relation that has multiple values for a single value of the primary key for that relation.
Definition: A relation is in 1NF if it does not contain any multi-valued dependencies.
Instructions:
Step 1: Create UNF Relation from a User View. The goal here is to create a single relation for the data found in the user view. The method used is:
• Examine the user view
• Identify all attributes
• Describe the user view using DBDL
Here is an example of a user view. This reports lists the customers of the Premiere Corporation.
Premiere Corporation Customer List
CustNo Name Street City State ZipCode SalesRepNo
124 Sally Adams 482 Oak Lansing MI 49224 03
256 Ann Samuels 215 Pete Grant MI 49219 06
315 Tom Daniels 914 Cherry Kent MI 48391 06
405 Al Williams 519 Watson Grant MI 49219 12
412 Sally Adams 16 Elm Lansin MI 49224 03
522 Mary Nelson 108 Pine Ada MI 49441 12
A. Examine the user view: As you examine this report, you can see that it contains a title, a line of column headings and the body of the report. Each line in the body of the report contains data about a particular customer. For example we can see that in the first line of the body of the report, there is data about Customer 124. This customer’s name is Sally Adams and she lives at 482 Oak in Lansing, Michigan (MI). The Sales Representative who calls on Sally Adams is Sales Rep Number 03.
B. Identify all attributes: The attributes (or characteristics) of a User View can often be found by simply looking at the column headings. In our Customer Report we see that we have the following attributes: Customer Number, Customer Name, Street, City, State, Zip Code and Sales Representative Number.
C. Describe the relation using DBDL: Database Design Language (DBDL) is a standardized way of describing relations of a relational database. You describe a relation by:
a. Choose an appropriate name for the relation. We chose to name our relation CUSTOMER because each line in the report describes customer data.
b. List the attributes you found in the user view inside square brackets, giving each attribute a suitable attribute name. Note: calculated fields or derived fields should not be included in the DBDL
c. Determine which attribute would be suitable as a primary key and underline that attribute.
The DBDL for the relation resulting from our Customer user view would look as follows:
CUSTOMER [ CustNo, CustName, CustStreet, CustCity, CustSt, CustZip, CustRep ]
Now you try it. Examine the following report:
Premiere Corporation Parts List
Part Number Part
Description Qnty On
Hand Class Warehouse
On Hand Price
AX12 Iron 104 HW 3 24.95
AZ52 Dartboard 20 SG 2 12.95
BA74 Basketball 40 SG 1 29.95
BH22 Cornpopper 95 HW 3 24.95
BT04 GasGrill 11 AP 2 149.99
BZ66 Washer 52 AP 3 399.99
CA14 Griddle 78 HW 3 39.99
CB03 Bike 44 SG 1 299.99
CX11 Blender 112 HW 3 22.95
CZ81 Treadmill 68 SG 2 349.95
What type of data does each line in the report represent?
_________________________________________________________________________
_________________________________________________________________________
What attributes can you identify from the user view?
________________________________
________________________________
________________________________
________________________________
________________________________ ________________________________
What would be a suitable name for the UNF relation? ___________________________
Which attribute would be suitable as a primary key? ___________________________
Describe the UNF relation using DBDL:
_____________________________________________________________________________
Step 2: Recognize Multi-valued Dependencies.
Premiere Corporation Customer Orders
Identify multi-valued dependencies in DBDL by placing brackets around them. For example the DBDL for this User View would look like this:
CUSTOMER [ CustNo, CustName, (OrderNum, OrderDate) ]
Notice the brackets around the OrderNum and Orderdate attributes. This quickly and easily identifies a multi-valued dependency to someone who is reading the DBDL.
Common Mistake: A common mistake is to incorrectly identify repeating data as a multivalued dependency. For example, the previous report could also have been printed in the following way:
Premiere Corporation Customer Orders
Step 3: Create 1NF relations from UNF.
Therefore, the process of taking a relation from UNF to 1NF, involves resolving the multi-valued dependencies.
Method:
- Choose a primary key for the multi-valued dependancy.
- Identify the primary key of the multi-valued dependancy by underlining it or writing (PK) .
- Rewrite the DBDL by removing the paranthesis and concatenating the original primary key with the primary key of the multi-valued dependency.
- Rewrite the DBDL with the two-part Primary Key and include all the non-key attributes.
For example, using our previous report from part B, we had the following:
UNF: Customer [ CustNo, CustName, ( OrderNum, OrderDate ) ]
A. Choose a primary key for the repeating group: OrderNum would make a suitable primary key for the repeating group as it uniquely identifies the data in the repeating group.
B. Rewrite the DBDL by removing the paranthesis and concatenating the original entity name with the entity name of the multi-valued dependency.
CustOrder [ CustNo, OrderNum, CustName, OrderDate ]
NOTE: If we start with a relation that does not contain any multi-valued dependencies, it is already in 1NF.
Lab 09 Submission:
Premiere Corporation Order Detail Report
Order
Number Part Desc Number
Ordered Quoted
Price Total
BZ66 Washer 2 399.99 799.98
BA74 Basketball 4 24.95 99.80
1NF:
Customers [Cust number]