Multiple choice technology databases

CREATE PROCEDURE p1() BEGIN CREATE TABLE T1 (C1 CHAR); INSERT INTO T1 VALUES ('A'); SAVEPOINT SAVEPOINT1 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('B'); SAVEPOINT SAVEPOINT2 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('C'); SAVEPOINT SAVEPOINT3 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('D'); ROLLBACK TO SAVEPOINT SAVEPOINT3; ROLLBACK TO SAVEPOINT SAVEPOINT1; COMMIT WORK; INSERT INTO T1 VALUES ('E'); END@ Call p1() @ How many rows will be present in Table T1

  1. 0

  2. 1 (A)

  3. 5 (A,B,C,D,E)

  4. 2 (A,E)

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

The procedure inserts 'A', sets SAVEPOINT1, then inserts 'B', 'C', and 'D' with subsequent savepoints. Rolling back to SAVEPOINT1 removes 'B', 'C', and 'D', leaving only 'A'. After the COMMIT, 'E' is inserted, resulting in two rows: 'A' and 'E'.