CSCE 413/813 Summer 1999

advertisement
NAME:
SSN:
Database Systems
Final Exam
CSCE 413/813
Summer 1999
SHOW YOUR WORK!
1. a.) What are the levels of data abstraction?
b.) Explain what each level means.
2. a.) What are ACID properties?
A stands for….
Meaning:
C stands for….
Meaning:
I stands for….
Meaning:
D stands for…
Meaning:
b.) Which part of the DBMS is responsible for
A_____________________________
C_________________________________
I______________________________
D__________________________________
3.
What is shadow paging recovery?
4.
What is timestamp-based protocol?
5. Use the following database schemes to answer questions 5.1. and 5.2 below. Give a
DATALOG program for each.
employee(person-name, street, city)
works(person-name, company-name, salary)
manages(person-name, manager-name)
company(company-name, city)
5.1.Find all employees who live in the city where the company for which they work is
located.
5.2.Find the name and the salary of all employees who work ( directly or indirectly)
under the manager “Craig Peters”.
5. 3 Find the equivalent expressions among a.)-g.) below. Answer in the following form:
a.)=b.) if you think that the expression in a.) is equivalent to the expression in b.)
The corresponding database schemes are: R=( A, B, C), S=(D, E, F).
a.)
b.)
c.)
d.)
e.)
f.)
g.)
A, F (C=D(r
x s))
select distinct A, F from r, s where r.C=17 and s.D=17
{t |  p  r  q  s ( t[A]=p[A]  t[F] = q[F]  p[C]= q[D])}
{t |  p  r  q  s ( t[A]=p[A]  t[F] = q[F]  p[C]= 17  p[C]=q[D])}
result(X,Y):-r(X, V, W), s(W, Z, Y).
result(X, Y):-r(X, V, 17), s(W, Z, Y) , Y=17.
result(X, Y):-r(X, V, W), s(C, Z, Y) , C=W.
6. Consider the following database log records.
a.) Decide the mode of the database modification recovery scheme ( ie. deferred or
immediate)
b.) What operations will be done and what will be the values of A, B, C if the system
chrashes:
Between f, g: operations will be done in this order in case log file (i):
values in the database case (i) before the crash: A=
B=
C=
Between j, k: operations in will be done in this order in case log file (i):
values in the database case (i) before the crash: A=
B=
C=
Between f, g: operations will be done in this order in case log file (ii):
values in the database case (ii) before the crash: A=
B=
C=
Between j, k: operations will be done in this order in case log file (ii):
values in the database case (ii) before the crash: A=
(i) mode ( deferred or immediate)?
a.)
b.)
c.)
d.)
e.)
f.)
g.)
<T1, start>
<T2, start>
<T1, A, 0, 1>
<T2, C, 30, 33>
<T3, start>
<T1, B, 20, 22>
<T1, commit) >
B=
C=
(ii) mode( deferred or immediate)?
a.)<T1, start>
b.)<T2, start>
c.)<T1, A, 1>
d.)<T2, C, 33>
e.)<T3, start>
f.)<T1, B, 22>
g.)<T1, commit>
h.)
i.)
j.)
k.)
l.)
<T3, B, 22, 222>
<T2, A, 1, 11>
<T2, commit)>
<T3, A, 11, 111>
<T3, commit>
h.)<T3, B, 222>
i.) <T2, A, 11>
j.) <T2, commit>
k.) <T3, A, 111>
l.) <T3, commit>
7.Consider the following transactions:
T1:
read (A)
read(B)
if A=0 then B:=B+1
write(B)
T2:
read (B)
read(A)
if B=0 then A: = A+1
write(A)
a.) Add lock and unlock instructions to transactions T1 and T2 so they observe the twophase locking protocol.
b.) Give an appropriate schedule (different from the serial one).
c.) What are the names of the two phases? Draw each phase in your schedule.
8. CREATE TABLE…Explain…
9. CREATE TRIGGER EXPLAIN
10. Role of DB admin
11. SQL transaction handling
12. SQL grants
Download