Lab_05(3)

DBA110 Database Concepts
Spring 2016
Lab Assignment 5 - 75 points
1. Given the dependency diagram below, answer items 2a - 2c: (5 Points)
C1
C2
C3
C4
C5
a. C1  C2 represents a _Partial Dependency___.
b. C4  C5 represents a ___Transitive Dependency___.
c. C1, C3  C2, C4, C5 represents a __Full Dependency___.
The dependency diagram below indicates that a patient can receive many
prescriptions for one or more medicines over time.
2. Based on the dependency diagram above, create a database whose tables are in at
least 3NF, showing the dependency diagram for each table. (10 Points)
Prepared by Cindy Waters
Page 1
DBA110 Database Concepts
Spring 2016
Lab Assignment 5 - 75 points
MedName
PatientID
PatientName
PatientID
PatientName
MedName
Date
RefillsAllowed
Dosage
ShelfLife
ShelfLife
Using the INVOICE table structure shown below, do the following:
Attribute Name Sample Value
INV_NUM
211347
PROD_NUM
AA-E3422QW
SALE_DATE
15-Jan-2010
PROD_LABEL
Rotary sander
VEND_CODE
211
VEND_NAME
NeverFail, Inc.
QUANT_SOLD 1
PROD_PRICE
$49.95
Prepared by Cindy Waters
Sample Value
211347
QD-300932X
15-Jan-2010
0.25-in. drill bit
211
NeverFail, Inc.
8
$3.45
Sample Value
211347
RU-995748G
15-Jan-2010
Band saw
309
BeGood, Inc.
1
$39.99
Sample Value
211348
AA-E3422QW
15-Jan-2010
Rotary sander
211
NeverFail, Inc.
2
$49.95
Sample Value
211349
GH-778345P
16-Jan-2010
Power drill
157
ToughGo, Inc.
1
$87.75
Page 2
DBA110 Database Concepts
Spring 2016
Lab Assignment 5 - 75 points
3. Write the relational schema, draw its dependency diagram and identify all
dependencies, including all partial and transitive dependencies. You can assume
that the table does not contain repeating groups and that any invoice number may
reference more than one product. (Hint: This table uses a composite primary key.)
(10
Points)
INV_NUM
PROD_NUM
SALE_DATE
PROD_LABEL VEND_CODE
VEND_NAME
QUANT_SOLD
PRICE
Relational Schema: INV_NUM, PROD_NUM, SALE_DATE, PROD_LABEL,
VEND_CODE, VEND_NAME, QUANT_SOLD, PRICE
4. Remove all partial dependencies, draw the new dependency diagrams, and
identify the normal forms for each table structure you created. (10 Points)
INV_NUM
INV_NUM
PROD_NUM QUANT_SOLD
SALE_DATE
3NF
3NF
PROD_NUM PROD_LABEL VEND_CODE
VEND_NAME
PRICE
2NF
5. Remove all transitive dependencies, and draw the new dependency diagrams. Also
identify the normal forms for each table structure you created. (10 Points)
Prepared by Cindy Waters
Page 3
DBA110 Database Concepts
Spring 2016
Lab Assignment 5 - 75 points
INV_NUM
PROD_NUM QUANT_SOLD
INV_NUM
SALE_DATE
3NF
PROD_NUM PROD_LABEL VEND_CODE
VEND_CODE
VEND_NAME
3NF
PRICE
3NF
3NF
6. To keep track of employees and departments, the Somewhere Company uses the
table structure shown below.
EmpID
100
200
300
400
500
LastName
Johnson
Abernathy
Smathers
Jackson
Caldera
FirstName
Sam
Jane
Henry
Ronald
Cindy
DeptID
325
350
350
300
400
Email
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
DeptName
Accounting
Finance
Finance
Production
Legal
DeptPhone
834-1100
834-1200
834-1200
834-1400
834-1000
a. Draw its dependency diagram, and identify all dependencies. You can assume
that the table does not contain repeating groups and the table uses a single
primary key. (10 Points)
EMP ID
LastName FirstName
DeptID
Email
DeptName DeptPhone
Prepared by Cindy Waters
Page 4
DBA110 Database Concepts
Spring 2016
Lab Assignment 5 - 75 points
b. Remove all dependencies and draw the new dependency diagrams. (10 Points)
EMP ID
LastName FirstName
DeptID
Email
DeptName DeptPhone
(Never specified what dependencies to remove?)
c. Using the results of 2b, draw the Crow’s Foot ERD. Make sure the ERD
includes primary keys, foreign keys, and attributes. (10 Points)
Employee
PK
Department
EMP ID
LastName
FirstName
Email
PK
DeptID
FK1
DeptName
EMP ID
Department Details
PK,FK1
DeptID
DeptPhone
Prepared by Cindy Waters
Page 5