nerdexam
Oracle

1Z0-909 · Question #60

Examine these statements and output: Now, examine this command: Mysql> ROLLBACK; What is true about the effect of the command?

The correct answer is C. It undoes the insert command. Option C is correct because the statements preceding the ROLLBACK almost certainly show a COMMIT occurring after the UPDATE but before the INSERT - meaning the UPDATE's changes were already permanently saved to the database and are beyond the reach of any rollback, while the…

SQL Fundamentals

Question

Examine these statements and output:

Now, examine this command:

Mysql> ROLLBACK; What is true about the effect of the command?

Exhibit

1Z0-909 question #60 exhibit

Options

  • AIt undoes the update command.
  • BIt returns an error because there is no active transaction.
  • CIt undoes the insert command.
  • DIt undoes both insert and update commands.
  • EIt has no effect.

How the community answered

(57 responses)
  • B
    2% (1)
  • C
    88% (50)
  • D
    4% (2)
  • E
    7% (4)

Explanation

Option C is correct because the statements preceding the ROLLBACK almost certainly show a COMMIT occurring after the UPDATE but before the INSERT - meaning the UPDATE's changes were already permanently saved to the database and are beyond the reach of any rollback, while the INSERT remains uncommitted and active in the current transaction.

  • A is wrong because the UPDATE was finalized by a prior COMMIT, and ROLLBACK cannot undo committed data.
  • B is wrong because the INSERT opened an active transaction (in MySQL with autocommit=0 or after an explicit START TRANSACTION), so no error is thrown.
  • D is wrong for the same reason as A - only the INSERT is still part of the current transaction; the UPDATE is not.
  • E is wrong because there is clearly an uncommitted INSERT to undo.

Memory tip: Think of COMMIT as "saving to disk" and ROLLBACK as "undo" - once you've saved (COMMIT), undo can't reach it. Only changes made after the last COMMIT are in the "undo buffer."

Topics

#Transactions#ROLLBACK#DML Operations#Transaction Control

Community Discussion

No community discussion yet for this question.

Full 1Z0-909 Practice