Bird
0
0

You run these commands with auto-commit OFF:

medium📝 Debug Q14 of 15
SQL - Transactions and Data Integrity
You run these commands with auto-commit OFF:
UPDATE products SET price = price * 0.9 WHERE category = 'Books';
COMMIT;
ROLLBACK;

What is the state of the prices after these commands?
APrices are updated with 10% discount
BPrices remain unchanged
CSyntax error due to ROLLBACK after COMMIT
DPartial update applied
Step-by-Step Solution
Solution:
  1. Step 1: Understand effect of UPDATE and COMMIT

    UPDATE changes prices, COMMIT saves these changes permanently.
  2. Step 2: Analyze ROLLBACK after COMMIT

    ROLLBACK after COMMIT has no effect because changes are already saved.
  3. Final Answer:

    Prices are updated with 10% discount -> Option A
  4. Quick Check:

    COMMIT saves changes; ROLLBACK after does nothing [OK]
Quick Trick: COMMIT saves changes; ROLLBACK after commit does nothing [OK]
Common Mistakes:
  • Thinking ROLLBACK undoes committed changes
  • Assuming partial updates without commit
  • Confusing syntax error with command order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes