Exam I March 28, 2008 Name________________
ComS 561 100 pts SSN_________________
8pts
1. Given the relations R(A B C) and S(B D E)
a e c b 1 3
d e f e 5 6
g e h i 8 3
j k l b 6 7
l b c
provide a) R natural join S b) Project S over E.
15pts
2. Describe the components needed for a web database application using struts, the flow of control in the web application using struts, and the flow of data in the web application using struts. Use an example as part of your answer.
11pts
3. Given a relational scheme R
= ABCDEFGHIJK and the set of functional dependencies F = {AB→K, CE→D, CE→F, F→G,
H→ IJ} determine the key of any relation r over scheme R and in SAT(F) using
the RAP sequence(Show your work).
10pts
4. Given the relations r(R), s(S), the relation schemes
R(A,B,C) and S(C,D,E) and the relational algebra query σA=10
(r join s),
provide the equivalent SQL statement.
10pts
5. Provide an example of a relational database scheme that is in 2NF, but not in 3NF.
10 pts
6. Briefly explain what is meant by a lossless join. Can we determine whether a join is lossless
before we see the data that will be joined?
Why or why not? Provide an
example as part of your answer.
10pts
7. Given the relation r below, explain why or why not the
dependencies a) AB→C b) CD→→F, c) BC→E hold in r.
r
|
A |
B |
C |
D |
E |
F |
G |
|
2 |
3 |
4 |
5 |
5 |
5 |
8 |
|
2 |
3 |
4 |
6 |
7 |
7 |
9 |
13pts
8. Briefly explain what Java Data Objects (JDO) are and why they are useful in an application that uses Java
to define the model classes. Your answer
should contain an example to illustrate the points that you are making.
13pts
9. Given the classes Employee, Department, and Customers
classes provide the relation mappings necessary to store instances of the
classes in relations using the mapping strategy discussed in class. You need to list the relation schemes for
each resulting relation and indicate places where attribute names represent the
same value.
public class Employee{
String name;
String streetAddress;
String city;
String state;
String zip;
String phoneNumber;
Collection<Customer> currentCustomersAssigned;
Collection<Department> assignedDepartments;
…
}
public class Department{
String deptName;
String division;
String deptNumber;
String deptAddress;
String phoneNumber;
Collection<Employee> currentEmployees;
…
}
public class Customer{
String customerNumber;
String customerName;
String customerAddress;
…
}