0% found this document useful (0 votes)
21 views4 pages

Final 2021

Uploaded by

sup87945487
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views4 pages

Final 2021

Uploaded by

sup87945487
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CS3010301 Database Systems

Final
Spring 2021
SID# & Name:
1. (20%) For the follow schedule with the given initial values, decide whether
a. (10%) the schedule is serializable
b. (10%) the schedule can be produced by a Two Phase Locking (2PL) scheduler
You need to justify your answers to receive full credits.
You can use the empty space in the schedule to place lock/unlock operations for your answers.

Initial values:
W=10
X=50
Y=30
Z=20

2. (20%) Suppose you are given a relation R with four attributes (ABCD). For each of the following
sets of FDs, assuming those are the only dependencies that hold for R, do the following: (1)
Identify the candidate key(s) for R. (2) Identify the best normal form that R satisfies (1NF, 2NF,
3NF, or BCNF). (3) If R is not in BCNF, decompose it into a set of BCNF relations that preserve
the dependencies.

a. (10%) A → C, D → B

Page 1 of 4
b. (10%) A → C, D → B, CD → A, CD → B

3. (30%) Consider the following schema:

students (sid, name, address, age)


courses (cid, name, profname)
registered (sid, cid, grade)

The key fields are underlined. The registered relation lists the grades in courses by students.
Formulate the following queries. If the query cannot be formulated, briefly explain why.

a. (10%) Write the query “Find the name of students who register in courses given by ‘Yi-Leh
Wu’” in SQL.

b. (10%) Write the query “Find pairs of student ids such that the student with the first sid got
lower grade in some classes than the student with the second sid”” in SQL.

c. (10%) Write the query “For each course name, retrieve the average grade of all students
taken that course” in SQL.

Page 2 of 4
4. (20%) Consider the following SQL query:

SELECT E.Fname, E.Lname, D.Dname


FROM EMPLOYEE E, PROJECT P, WORK_ON W, DEPENDENT D
WHERE W.Hours > 50 AND E.Ssn = W.Essn AND E.Ssn = D.Essn AND
W.Pno = P.Pnumber AND E.Salary > 20000;

(a) (5%) Draw the query graph.

(b) (15%) Draw the initial query tree and the optimized query tree using heuristic optimization.
Briefly explain your assumptions.

Page 3 of 4
5. (10%) Consider the concurrent transaction processing log shown below. Suppose that we use the
in-place deferred update protocol with checkpointing.

Step Log Entry

1 <T2, start>
2 <T2, X, 0, 1>
3 <T1, start>
4 <T2, commit>
5 <checkpoint>
6 <dump>
7 <T1, Y, 1, 2>
8 <T3, start>
9 <T3, X, 3, 4>
10 <T4, start>
11 <T4, Z, 2, 3>
crash
12 <T1, commit>
13 <T3, Y, 1, 2>
14 <T4, X, 2, 5>

Give recovery actions AND the log entries required for EACH transaction given the event of failure
(RAM lost) between step 11 and 12. Briefly explain why.

Page 4 of 4

You might also like