Uploaded by hind.binajlan

Advanced Database Exam

advertisement
King Saud University
College of Computer & Information Sciences
Computer Science Department
CSC581: Advanced Database
Final Exam
Instructor: Dr. Touir Ameur
Tuesday: 18/7/34 (28/5/13) Time: 3H
Question 1: (10 Marks)
Map the following ER diagram into a relation schema. Notice that c1 is a partial key for the
entity C and a1 is a partial key for the entity A
Question 2: (10 Marks)
Given R (A, B, C, D, E) and the following set of functional dependencies
F={A➔BC, CD➔A, D➔E, E➔DB}:
●
give the minimal cover of R
● GIVE All candidate keys
● Is the decomposition R1(A,B), R2(A,D), R3(D,E,C) lossless? Prove your answer.
● Give A BCNF decomposition of R.
Question 3: (10 Marks)
Given two relation R1(a1, a2, a3) with N1 tuples and R2(b1, b2, a1) with N2 tuples. We suppose
that a1 in R2 is a foreign key referencing a1in R1.
Explain when each of the following cases is possible (Card means cardinality – the number
of element­):
Card(​
Π​
(R1))= Card(R1)
a1​
c.
Card(​
σ​
(R1)= 0
a1=10​
e.
Card (R1
R2)= Card(R1)
b. Card(​
Π​
(R1))= Card(​
Π​
(R2))
a1​
a1​
d.
Card(​
σ​
(R1) > Card(R1)
a1=10​
f.
Card (R1
R2)= Card(​
Π​
(R1))
a1​
a.
Question 4: (10 Marks)
♦ Customer(CId, name, JobPosition, City)
♦ Flight(FId, DepartureAirport, ArrivalAirport, DepartureDate)
♦ Reservation (CId, FId, Status, Class, Cost)
▪
Status shows if the reservation is confirmed or not
confirmed
▪
Class gives the class chosen by the traveler in that flight
▪
Cost gives the amount to be paid by the traveler
G
​iven the above defined schema, use the relational algebra language and SQL to answer the
following queries :
1­ Retrieve the cost and the class of the flights reserved by “Majed AlOtaibi”.
2­ Retrieve the number of Engineers who travelled to Geneva on the 10/5/2010
3­ Retrieve the cheapest flight to Geneva before the 10/7/2010.
4­ List the engineers who travelled to Geneva more than 10 times on the business class .
Download