Bird
0
0

If Transaction 1 repeats the read, what phenomenon might it experience?

medium📝 query result Q4 of 15
SQL - Transactions and Data Integrity
Consider two transactions running concurrently on a table Products. Transaction 1 reads all rows where price > 100. Transaction 2 inserts a new row with price = 150 but has not committed yet. If Transaction 1 repeats the read, what phenomenon might it experience?
APhantom read
BNon-repeatable read
CDirty read
DLost update
Step-by-Step Solution
Solution:
  1. Step 1: Analyze Transaction 2's action

    Transaction 2 inserts a new row but has not committed yet, so the data is uncommitted.
  2. Step 2: Understand Transaction 1's repeated read

    If Transaction 1 reads this uncommitted row, it is a dirty read because the data is not yet committed.
  3. Final Answer:

    Dirty read -> Option C
  4. Quick Check:

    Uncommitted insert read = Dirty read [OK]
Quick Trick: Reading uncommitted inserts causes dirty reads [OK]
Common Mistakes:
  • Assuming phantom read without commit
  • Confusing non-repeatable read with phantom read
  • Ignoring commit status of inserted row

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes