Transactions & ACID · SQL SQL
Explain the difference between a 'Dirty Read' and a 'Non-Repeatable Read' anomaly.
Practice question from Transactions & ACID (SQL SQL), with the correct answer and a step-by-step solution.
medium · Subjective · Q-D3E21C
Explain the difference between a 'Dirty Read' and a 'Non-Repeatable Read' anomaly.
Answer: A dirty read occurs when a transaction reads data that has been modified by another concurrent, uncommitted transaction. A non-repeatable read occurs when a transaction reads the same row twice, but gets different data because another concurrent transaction updated and committed changes to that row in between the reads.
Solution
A dirty read involves uncommitted data that might be rolled back, whereas a non-repeatable read involves committed changes that alter data read earlier in the same transaction.
More from Transactions & ACID
- Which property of ACID ensures that once a transaction has been committed, its effects are permanently recorded in the database, even in th…
- In PostgreSQL and MySQL, what is the default transaction isolation level?
- Which of the following phenomena can still occur under the 'Repeatable Read' isolation level in standard ANSI SQL, but is prevented in Post…
- What is the primary purpose of the Write-Ahead Logging (WAL) protocol in database transaction management?
Practise more SQL
Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.
Start practising freeFree to start · No credit card needed