Logged in as: guest Log in
Problem Set #5 kemal / Version 12

 


 

Comp 521: Files and Databases -- Fall 2012

Problem Set #5

Issued: 11/20/2010      Due: In class 12/4/2010


Homework Information: Some of the problems are probably too long to attempt the night before the due date, so plan accordingly. Late homework will penalized by a factor of 70.71% for each late class period. Feel free to work with others, but the work you hand in should be your own.

 

Show your work for all parts of all the questions, You may not get credit if you only give the result without explaining how you get the result.

Question 1


For each of the following relations, tell which normal form it is (none, 1NF, 2NF, 3NF, or BCNF) and why.  If it is less than 3NF, give an equivalent 3NF schema

A) Users [username, password, first_name, last_name, birth_date] 

[username] is the primary key.  username  password.

B) Users [username, password, first_name, last_name, birth_date] 

[username] is the primary key.  username  password, first_name  username

C) R(A,B,C,D,E,F) 

[A,B,C,F] is primary Key, A BC, D AF

D) Actors [ Name, Surname, Sex, Rating, BirthDate, ]

[Name, Surname] is the primary key.  Birthdate → Sex.

E) Invoices [date, customer_id, inventory_id, address, phone, associate_name]

The primary key is date, customer_id, inventory_id].  associate_name customer_id.

 

Question 2


Consider the following relation:

R(A, B, C, D, E, F, G)

With these five functional dependencies:

D1: F A → C

D2: E B → F G

D3: F → A C

D4: D → E

D5: D → C

A)    Find a key for this relation and show how you found it.

B)     Find a minimal cover for these functional dependencies.

C)     Using the result from part A, find a 3NF lossless-join dependency-preserving decomposition

D)    Find a lossless-join BCNF decomposition.

 

Question 3


Consider the following schema:
Employees(eid: integer, fname: text, lname text)
Hours(hid: integer, eid:integer, project_name: text, rate_per_hour: real, hours_worked: integer)

You are told that the following three queries are extremely important:
  1. Finding the total number of projects that employees who worked a given project specified by name.
  2. Listing the project names which has lowest employee per hour rate rate per hour
  3. Computing the cost charged for each employee (Σh=hours worked on projecth.rate_per_hour*h.hours_worked)
A) Describe the indices and file layout that you would use for each relation. Note the queries addressed by each of your index and clustering choices.

B) Suppose that the performance of query 3 was still unsatisfactory. What minimal index would provide an index-only plan for resolving query 3? 

C) Using the indices and the file organization from part A, provide a sketch of a query evaluation plan for query 1.

Question 4


 

For each of the following relation and functional dependencies, find the BCNF decomposition.  For each part, show your work by filling the following table.

 

  FD to Deal With  Old Relation New Relation 1 New Relation 2
Step 1        
Step 2        
 ...etc        

 

A) R1(A,B,C,D,E), A → C, B→ D,  ABE → ABCDE
B) R2(A,C,B,D,E), BC → A, D→ B, B→ E 
C) R3(A,C,B,D,E), A → BC,  CD → E,  B → D,  E → A. 
D) R4(A,C,B,D,E), A → CD, B → C, E → B.


 




Site built using pyWeb version 1.10
© 2010 Leonard McMillan, Alex Jackson and UNC Computational Genetics