Mid-Term Exam – 19th Oct

advertisement
Final Exam CS 304 Database Systems
Students’s Name –
Date - 13th Dec. 2000
Total Marks – 35
Marks Obtained -
Note – Each question should be answered using all the necessary steps.
Marks will be awarded based on each correct STEP, only a fraction of
marks will be given for any direct answer.
Q1. Consider the following domian of criminal court cases:
Each judge has a list of outstanding cases over which he will preside. Only one judge
presides per case. For each case one prosecuting counsel is appointed to present the
Department of Public Prosecutions. Cases are scheduled at one Crown Court for an
estimated duration from a given start date. A case can try more than one crime (ex.
robbery, murder, etc.) Each crime can have one or more defendents. Each defendent can
have one or more counsel defending. Defendants may have more than one outstanding
case against them.
(i)
Draw an E-R diagram. State your assumptions.
(ii) Convert above -E-R diagram to a relational model. Specify all primary keys.
2.5
2.5
2
Q2. (A). Consider the three transactions T1, T2 and T3 and the schedule S1 and S2 given
below. Schedule has interleaving of operations of three transactions and are executed in
that order.
Draw the serlizability graphs for S1 and S2 and state whether each schedule is
serializable or not. If it is, write down the equivalent serial schedule.
3
T1: r1 (x), r1(z), w1(z)
T2: r2(Z) r2(y), w2(z), w2(y)
T3: r3(x), r3(y), w3(y)
S1 : r1(x), r2(z), r1(z), r3(x), r3(y), w1(x), w3(y), r2(y), w2(z), w2(y)
S2 : r1(x), r2(z), r3(x), r1(z), r2(y), r3(y), w1(x), w2(z), w3(y), w2(y)
3
Q2 (B) . Consider the following three transactions
T1 : Begin
read(y)
y = y+1
write y
T2 : Begin
read(x)
read(y)
y = y+1
write y
T3 : Begin
read(x)
x=x+1
write (x)
Show a concurrent execution of T1,T2,T3, and show that it produces a serializable
schedule. Write the equivalent serial schedule.
5
4
Q3. Write the following queries in SQL using the relaions:
7.5
Book(ISBN#, Title, Author, Publisher), Member(member #, Name, address)
Borrowed(ISBN #, Member #, Date-borrowed)
(i) Find the titles of all books which were borrowed on 15th Feb.96.
(ii) Find the name of the members who have borrowed the book title “DBMS” on
12th March, 1987.
(iii) Find the titles and author of all the books which have been never borrowed.
(iv) Find the names of the members who have borrowed at least those books which
have been borrowed by member # 342.
(v) Find the books which have never been borrowed by member # 345.
5
Q4 (a). Consider the following example
Advisor ( Student-SSN, Major, Faculty name) . Only one major is associated with one
faculty name. A student can take many major.
(i)
(ii)
(iii)
(iv)
What is the primary key.
1
List the functional dependencies.
1
What are insertion, deletion and modification anomalies with this relation. 1.5
Check if the relation satisfies BCNF and if not, break the relation. 1.5
6
Q. 5 Do either A or B.
(A)Consider the following relation
Emp-Dept (Emp-name, SSN, Birth-date, Address, Dept-number, Dept-name, Dmgr-SSN)
And the following set of functional dependency G
SSN  {Emp-name, Birth-date, Address, Dept-number}
Dept-number  {Dept-name, Dmgr-SSN}
(i)
Find a minimal set of functional dependency for G.
2.5
(Not this time)
(ii) Consider a relation R (A, B, C, D, E) with the following set of functional dependency
AB C , CD E, DE B
Find the candidate key. Show all the steps.
2.5
5(C) Check if the following set of functional dependencies are equivalent.
F = { A C, AC D, E  AD, E H } and G = {A CD, E AH}
5
7
Q6. Consider the relation for published books :
Book (Book_title, Author-SSN, Book-Type, List-price, Author-Affiliation,
Publisher). One book can have many authors.
Consider the following set of functional dependency G
Book_title  publisher, book-type
Book-type  List-price
Author-SSN  Author-affiliation
(1) what normal form this relation is ? Explain your answer.
2
(2) Apply normalization until there is no further decomposition possible. State reason
behind each break-up.
2.5
8
9
Download