Docsity

Practice Homework 5 - Database Management Systems | COP 5725, Assignments of Computer Science

Toggle sidebar
bg1
Database Management Systems (COP 5725)
(Fall 2008)
Instructor: Dr. Markus Schneider
TAs:
Mingsong Chen
Wenjie Yuan
Homework 5
Name:
UFID:
Email Address:
Pledge (Must be signed according to UF Honor Code)
On my honor, I have neither given nor received unauthorized aid in doing this assignment.
_______________________________________________Signature
For scoring use only:
Maximum Received
Exercise 1 20
Exercise 2 20
Exercise 3 20
Exercise 4 20
Exercise 5 20
Total 100
pf3
pf4
pf5

Partial preview of the text

Download Practice Homework 5 - Database Management Systems | COP 5725 and more Assignments Computer Science in PDF only on Docsity!

Database Management Systems (COP 5725)

(Fall 2008)

Instructor: Dr. Markus Schneider

TAs:

Mingsong Chen Wenjie Yuan

Homework 5

Name: UFID: Email Address:

Pledge (Must be signed according to UF Honor Code)

On my honor, I have neither given nor received unauthorized aid in doing this assignment.

_______________________________________________Signature

For scoring use only:

Maximum Received

Exercise 1 20

Exercise 2 20

Exercise 3 20

Exercise 4 20

Exercise 5 20

Total 100

Exercise 1 (Concept) [20 points]

  1. What is a trigger? Discuss the strengths and weaknesses of the trigger mechanism. [2 points]
  2. Give a set of FDs for the relation schema R(A,B,C,D) with primary key AB under which R is in 1NF but not in 2NF. [2 points]
  3. Give a set of FDs for the relation schema R(A,B,C,D) with primary key AB under which R is in 2NF but not in 3NF. [3 points]
  4. Please use Armstrong’s axioms (You can also use the other three extended rules) to give proofs to the following deductions. If it is not correct you have to show examples. (First state if it is correct or not, if correct then prove it, otherwise show counterexample) [4*2 points]

a) { X∪Y→Z, Y→W } ⇒ { X∪W→Z }

b) { X→Z, Y→Z } ⇒ { X→Y }

c) { X→Y, X∪Y→Z } ⇒ { X→Z }

d) { X→Y, Z→W } ⇒ { X∪Z→Y∪W }

Exercise 2 (Closure) [20 points]

Given relation:

R= {A,B,C,G,H,I}

and a set F of functional dependencies:

F= {A → B, A → C, CG → H, CG → I, B → H}

(a) Determine the closure F+ of F (Note: Trivial dependencies do not have to be shown). [10 points]

(b) Given a functional dependency X → Z (where X, Z ⊆ R).

  1. How can we check whether X → Z ∈ F+ without having to compute F+? [5 points]
  2. Write down an algorithm that implements the method you propose. [5 points]

Exercise 3 (FD and Canonical Cover) [20 points]

  1. Consider the attribute set R = ABCDEGH and the FD set F = {AB → C, AC → B, AD → E, B → D, BC → A, E → G}. For each of the following attribute sets, do the following:

(i) Please write down a minimal cover of the dependencies hold on the set given in (a), (b). [2+2 points] (ii) Name the strongest normal form that is not violated by the relation containing these attributes. [3+3 points] (a) ABCEG

(b) DCEGH

  1. For the following decomposition of R = ABCDEG, with the same set of dependencies F from last question (F = {AB → C, AC → B, AD → E, B → D, BC → A, E → G}), specify if it is:

(a) dependency-preserving? [5 points] (b) lossless-join? [5 points]

Explain the reason.

(1) R→{AB, BC, ABDE, EG}

(2) R→{ABC, ACDE, ADG }

Exercise 5 (Data Integrity) [20 points]

Consider the following relational schema and briefly answer the questions that follow:

Emp( eid: integer, ename: string, age: integer, salary: real)

Works( eid: integer, did: integer, pct time: integer)

Dept( did: integer, budget: real, managerid: integer)

  1. Define a table constraint on Emp that will ensure that every employee makes at least $10,000. [5 points]
  2. Define a table constraint on Dept that will ensure that all managers have age > 30. [5 points]
  3. Define an assertion on Dept that will ensure that all managers have age > 30. Compare this assertion with the equivalent table constraint. Explain which is better. [5 points]
  4. Write SQL statements to delete all information about employees whose salaries exceed that of the manager of one or more departments that they work in. Be sure to ensure that all the relevant integrity constraints are satisfied after your updates. [5 points]