Reference no: EM132135875
SQL Transactions Exercises
Consider table Item(name,price) where name is a key, and the following two concurrent transactions.
T1:
Begin Transaction;
Update Item Set price = 2*price Where name = 'pencil';
Insert Into Item Values ('scissors', $100);
Commit;
T2:
Begin Transaction;
select max(Price) as a1 From Item;
select max(Price) as a2 from Item;
Commit;
Assume that the individual statements in each transaction always execute atomically. Suppose initially there are two tuples in Item: (pencil,1000) and (pen,900). Each transaction runs once and commits. Transaction T1 always executes with isolation level Serializable.
(a) If transaction T2 executes with isolation level Serializable, what possible pairs of values a1 and a2 are returned by T2?
(b) If transaction T2 executes with isolation level Repeatable-Read, what possible pairs of values a1 and a2 are returned by T2?
(c) If transaction T2 executes with isolation level Read-Committed, what possible pairs of values a1 and a2 are returned by T2?
(d) If transaction T2 executes with isolation level Read-Uncommitted, what possible pairs of values a1 and a2 are returned by T2?