Bird
0
0

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

medium📝 query result Q13 of 15
SQL - Transactions and Data Integrity
Consider two transactions running concurrently on a table Orders. Transaction 1 reads all rows where status = 'pending'. Transaction 2 inserts a new row with status = 'pending' and commits. If Transaction 1 repeats the read, what phenomenon might it observe?
ADirty read
BNon-repeatable read
CPhantom read
DLost update
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the scenario with inserted rows

    Transaction 1 reads rows with status 'pending'. Transaction 2 inserts a new 'pending' row and commits.
  2. Step 2: Identify the phenomenon on repeated read

    When Transaction 1 reads again, it sees the new row that wasn't there before. This is a phantom read, where new rows appear between reads.
  3. Final Answer:

    Phantom read -> Option C
  4. Quick Check:

    New rows appearing = Phantom read [OK]
Quick Trick: New rows between reads = phantom read [OK]
Common Mistakes:
  • Confusing phantom read with dirty read
  • Thinking non-repeatable read applies to new rows
  • Mixing lost update with read phenomena

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes