Bird
0
0

What is wrong with this transaction?

medium📝 Debug Q7 of 15
SQL - Transactions and Data Integrity
What is wrong with this transaction?
BEGIN TRANSACTION;
UPDATE employees SET salary = salary + 1000;
ROLLBACK;
COMMIT;
AMissing SAVEPOINT before ROLLBACK
BROLLBACK should be after COMMIT
CCannot update without WHERE clause
DCOMMIT after ROLLBACK commits no changes
Step-by-Step Solution
Solution:
  1. Step 1: Understand ROLLBACK effect

    ROLLBACK cancels all changes made in the transaction.
  2. Step 2: Effect of COMMIT after ROLLBACK

    COMMIT after ROLLBACK commits no changes because transaction is empty.
  3. Final Answer:

    COMMIT after ROLLBACK commits no changes -> Option D
  4. Quick Check:

    ROLLBACK clears changes before COMMIT [OK]
Quick Trick: ROLLBACK clears changes; COMMIT after saves nothing [OK]
Common Mistakes:
  • Thinking COMMIT saves rolled back changes
  • Believing ROLLBACK must follow COMMIT
  • Confusing SAVEPOINT necessity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes