Bird
0
0

Examine this transaction:

medium📝 Debug Q6 of 15
SQL - Transactions and Data Integrity
Examine this transaction:
BEGIN TRANSACTION;
UPDATE orders SET status = 'shipped' WHERE id = 5;
COMMIT;
ROLLBACK;

What is the issue here?
ACOMMIT should come after ROLLBACK
BROLLBACK after COMMIT has no effect and is redundant
CBEGIN TRANSACTION is missing a semicolon
DUPDATE statement syntax is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Analyze transaction flow

    Transaction starts, updates data, then commits changes.
  2. Step 2: Understand ROLLBACK usage

    ROLLBACK undoes uncommitted changes; after COMMIT, it has no effect.
  3. Final Answer:

    ROLLBACK after COMMIT has no effect and is redundant -> Option B
  4. Quick Check:

    ROLLBACK cannot undo committed transactions [OK]
Quick Trick: ROLLBACK after COMMIT does nothing [OK]
Common Mistakes:
  • Thinking ROLLBACK can undo committed changes
  • Believing COMMIT must follow ROLLBACK
  • Assuming syntax errors in UPDATE statement

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes