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

All of Transactions & ACID

Practise more SQL

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed