I have two transactions that are the following:
T1:
Begin Transaction;
S1: Insert Into Salary Values (103, 60000);
S2: Update Salary Set salary = salary + 10000 Where id = 101;
Commit;
T2:
Begin Transaction;
S3: Select Avg(salary) As a1 From Salary;
S4: Select Avg(salary) As a2 From Salary;
Assume that the individual statements S1, S2, S3, and S4 always execute atomically. Suppose initially there are two tuples in Salary: (101,30000) and (102,50000). Each transaction runs once and commits. Transaction T1 always executes with isolation level Serializable (the highest level).
a) If transaction T2 executes with isolation level Serializable, what possible pairs of valuesa1 and a2 are returned by T2?
b) If transaction T2 executes with isolation level Read-Committed, what possible pairs of values a1 and a2 are returned by T2?
c) If transaction T2 executes with isolation level Read-Uncommitted what possible pairs of values a1 and a2 are returned by T2?
Here are my answers:
a) S1 – S2 – S3 – S4 Value: a1: 50000 , a2: 50000
S3 – S4 – S1 – S2 Value: a1: 40000, a2: 40000
But I'm a bit confused on how read-committed and how read-uncommitted work. Any help with B and C, would be a great help.