Bird
0
0

Find the problem in this transaction:

medium📝 Debug Q7 of 15
SQL - Transactions and Data Integrity
Find the problem in this transaction:
BEGIN TRANSACTION;
DELETE FROM users WHERE id = 5;
UPDATE users SET name = 'John' WHERE id = 6;
AMissing COMMIT or ROLLBACK to end the transaction
BDELETE statement syntax is incorrect
CUPDATE statement cannot be inside a transaction
DBEGIN TRANSACTION is not supported in SQL
Step-by-Step Solution
Solution:
  1. Step 1: Check transaction completeness

    Every transaction must end with COMMIT or ROLLBACK to finalize changes.
  2. Step 2: Identify missing statement

    This transaction lacks COMMIT or ROLLBACK, so it remains open and uncommitted.
  3. Final Answer:

    Missing COMMIT or ROLLBACK to end the transaction -> Option A
  4. Quick Check:

    Transactions must end with COMMIT or ROLLBACK = B [OK]
Quick Trick: Always finish transactions with COMMIT or ROLLBACK [OK]
Common Mistakes:
  • Assuming transactions auto-commit without COMMIT
  • Thinking DELETE syntax is wrong
  • Believing UPDATE can't be in transactions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes