Bird
0
0

Given the commands:

medium📝 query result Q5 of 15
SQL - Transactions and Data Integrity
Given the commands:
BEGIN TRANSACTION;
UPDATE products SET price = price * 1.1 WHERE category = 'Books';
COMMIT;
SELECT price FROM products WHERE category = 'Books';

What will the SELECT query show?
APrices decreased by 10% for books
BPrices unchanged for books
CAn error due to missing ROLLBACK
DPrices increased by 10% for all books
Step-by-Step Solution
Solution:
  1. Step 1: Understand the UPDATE and COMMIT

    UPDATE increases prices by 10%, COMMIT saves these changes permanently.
  2. Step 2: Effect on SELECT query

    SELECT shows updated prices reflecting the 10% increase for books.
  3. Final Answer:

    Prices increased by 10% for all books -> Option D
  4. Quick Check:

    COMMIT saves updated prices [OK]
Quick Trick: COMMIT saves updates made in transaction [OK]
Common Mistakes:
  • Assuming prices unchanged without commit
  • Thinking ROLLBACK needed to save
  • Confusing increase with decrease

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes