0

I have some problems in understanding sql isolation level.

I have table R with attribute A and values 1 and 2

T1:
UPDATE R SET A=2*A
INSERT INTO R VALUES(6)

T2:
SELECT AVG(A) FROM R
SELECT AVG(A) FROM R

What will be the result if the second transaction is executed using REPEATABLE READ ISOLATION LEVEL?

I know that update is not allowed but insert is, so it will be 1.5 and 3?

  • 1
    Of course the update would be allowed. Why do you think it isn't? –  Jan 31 '17 at 10:53
  • @a_horse_with_no_name because i read: New rows may be added by a concurrent transaction, but the existing rows cannot be deleted nor changed – Darius Ionut Jan 31 '17 at 10:55
  • Then you read incorrectly (or the DBMS you are using doesn't properly support this). repeatable read guarantees that the second transaction will not see any modifications - so both statements for T2 will return 1.5 regardless on what T1 did. –  Jan 31 '17 at 11:07
  • @a_horse_with_no_name but the problems is that i have 4 answers to this question and i have to select 1: a)1.5, 4 b) 1.5, 2, 4 c) 1.5, 3, 4 d) 1.5, 2, 3, 4 – Darius Ionut Jan 31 '17 at 11:10
  • @DariusIonut are you do a school test or what? – Eugenio Jan 31 '17 at 11:23
  • @Eugenio I am doing some exemples, can you help me or not? – Darius Ionut Jan 31 '17 at 11:57
  • @DariusIonut:people can help,you need to add more info.. – TheGameiswar Jan 31 '17 at 12:00

0 Answers0