Вы находитесь на странице: 1из 1

Database Systems 2

Proff. Piero Fraternali, Stefano Ceri – September 10th, 2008 – Time: 2h

A. Active Rules. (6 points) Consider the database about bank accounts:


ACCOUNT(Code, Balance, DateEndTrimester, BalanceEndTrimstr)
TRANSACTION(Code, Date, ProgressiveNum, Amount)

In every account, the balance expresses exactly the value of the last trimester balance plus the algebraic sum of the
amounts of transactions upon the account which took place afterwards. Express this property as a constraint on the
schema and then write a constraint capable of preserving the constraint. Which solution would you impement in a real
system? And why?
C. XML and OQL. (10 points)
The following DTD describes an xml document containing the forecasts for the next 10 days of different cities starting
from the current date. Elements which are not further specified only contain PCDATA.
<!ELEMENT 10DaysForecast (CurrentDate, City+)>
<!ELEMENT City (Name, Country, Day+)>
<!ELEMENT Day (Description, HighTemp, LowTemp, Wind, Humidity, Visibility, HourByHour+)>
<!ATTLIST Day Date CDATA #REQUIRED >
<!ELEMENT HourByHour (Hour, Temperature)>

1) Write in XQuery the query asking for the hottest Italian city (or cities, if they have the same temperature) whose
description contains “showers” on the 12 September 2008. The result should report both the name of such city
(cities) and the hour(s) when the hottest temperature will occur.(3 p)
2) Extract in XQuery the cities that at least for 6 days (not necessarily consecutive) of the 10 days of the forecasts, at
noon have the same temperature of Milan (3 p)
3) Define a suitable object-oriented schema to represent the data of the xml document (1,5 p)
4) Express in OQL query 1) (2,5 p)

C. Concurrency Control. (5 points)


Present examples of schedules having the following properties:
A. Belonging to CSR but not belonging to 2PL
B. Belonging to CSR but not belonging to TS
C. Belonging to TS but not belonging to 2PL
D. Belonging to 2PL but not belonging to TS
E. Belonging to Multi-version TS but not belonging to TS
Discuss your choices briefly.

D. Recovery (5 punti)
Given the following log:
B(T1), B(T2), D(T2, O2, B2), I(T1, O1, A1), B(T4), B(T3), U(T4, O3, B3, A3), C(T2), U(T1, O4, B4, A4), CK(T1, T3,
T4), B(T5), U(T5, O5, B5, A5), B(T6), A(T3), CK(T1, T4, T5, T6), B(T7), A(T4), U(T7, O6, B6, A6), U(T6, O3, B7,
A7), B(T8), A(T7), failure
describe the operations needed for the warm restart and explicitly report all the recovery actions that have to be executed.

E. Question. (5 points)
Illustrate the advantages and rationale of the simplification "presumed abort" of the two-phase commit.

Вам также может понравиться