Multiple choice technology databases

Given the table, Customer contain the following data Customer Table: Product-ID Quantity 1 5 2 3 3 4 The following sequence of statement performed at the single unit of work: UPDATE Customer SET Quantity = 3 WHERE Product-ID = 1; SAVEPOINT s1 ON ROLLBACK RETAIN CURSORS; UPDATE Customer SET Quantity = 5 WHERE Product-ID = 3; INSERT INTO Customer VALUES (5, 20); SAVEPOINT s2 ON ROLLBACK RETAIN CURSORS; INSERT INTO Customer VALUES (4, 10); ROLLBACK TO SAVEPOINT s1; INSERT INTO Customer VALUES (6, 10); INSERT INTO Customer VALUES (7, 15); COMMIT;

  1. 1-5, 2-3, 3-5, 4-10, 5-20, 6-10, 7-15

  2. 1-3, 2-3, 3-4, 6-10, 7-15

  3. 1-3, 2-3, 3-4, 4-10, 5-20, 6-10, 7-15

  4. 1-3, 2-3, 3-4

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The transaction starts with Customer having (1,5), (2,3), (3,4). UPDATE sets Product-ID 1 to 3. SAVEPOINT s1 is set. UPDATE sets Product-ID 3 to 5. INSERT adds (5,20). SAVEPOINT s2 is set. INSERT adds (4,10). ROLLBACK TO s1 undoes everything after s1: the second UPDATE and both INSERTs are rolled back. After ROLLBACK, Product-ID 1 is 3, Product-ID 3 is 4 (unchanged from initial). Then INSERT adds (6,10) and (7,15). COMMIT finalizes: (1,3), (2,3), (3,4), (6,10), (7,15). Option B matches this final state.