Transaction A | Transaction B |
--Empty Table T has a PRIMARY KEY on attribute PK BEGIN TRANSACTION; SELECT A FROM T; --sees an empty table INSERT INTO T VALUES(6); INSERT INTO T VALUES(7); SELECT A FROM T; --sees 6 and 7 SELECT A FROM T; --sees 6 and 7 COMMIT; --success | BEGIN TRANSACTION; SELECT A FROM T; --sees an empty table INSERT INTO T VALUES(5); INSERT INTO T VALUES(7); SELECT A FROM T; --sees 5 and 7 SELECT A FROM T; --sees 5 and 7 COMMIT; --fails due to a primary key violation on 7 |