Multiple choice technology databases

Which of the following are reasonable series of transaction-control commands?

  1. Insert some records, COMMIT, ROLLBACK

  2. SAVEPOINT, insert some records, ROLLBACK, ROLLBACK, COMMIT

  3. ROLLBACK, insert some records, COMMIT

  4. ROLLBACK, insert some records, COMMIT, COMMIT

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

Option C is valid: ROLLBACK with no active transaction is a no-op (does nothing harmlessly), then insert records, then COMMIT saves them. Option A is invalid because COMMIT then ROLLBACK makes no sense - records are already committed. Option D has redundant COMMIT. Option B has improper ROLLBACK sequence.