0
0
SQLquery~5 mins

Transaction isolation levels in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of transaction isolation levels in databases?
Transaction isolation levels control how and when the changes made by one transaction become visible to other transactions, helping to prevent problems like dirty reads, non-repeatable reads, and phantom reads.
Click to reveal answer
beginner
Name the four standard transaction isolation levels defined by SQL.
The four standard isolation levels are:<br>1. Read Uncommitted<br>2. Read Committed<br>3. Repeatable Read<br>4. Serializable
Click to reveal answer
intermediate
What problem does the Read Uncommitted isolation level allow that others prevent?
Read Uncommitted allows dirty reads, meaning a transaction can see uncommitted changes made by other transactions, which might later be rolled back.
Click to reveal answer
advanced
Explain the difference between Repeatable Read and Serializable isolation levels.
Repeatable Read prevents dirty and non-repeatable reads by ensuring data read once cannot change during the transaction, but phantom reads can still occur.<br>Serializable is the strictest level, preventing dirty reads, non-repeatable reads, and phantom reads by making transactions appear as if they run one after another.
Click to reveal answer
intermediate
What is a phantom read in the context of transaction isolation?
A phantom read happens when a transaction reads a set of rows matching a condition, but a subsequent read in the same transaction finds new rows that were inserted by another committed transaction.
Click to reveal answer
Which isolation level allows a transaction to read data that another transaction has modified but not yet committed?
ARead Uncommitted
BRead Committed
CRepeatable Read
DSerializable
Which isolation level guarantees that if you read the same row twice in a transaction, you get the same data both times?
ARead Uncommitted
BRead Committed
CRepeatable Read
DSerializable
What problem does the Serializable isolation level prevent that Repeatable Read does not?
ADirty reads
BNon-repeatable reads
CLost updates
DPhantom reads
Which isolation level is the least strict and can lead to the most concurrency but also the most anomalies?
ARepeatable Read
BRead Uncommitted
CRead Committed
DSerializable
In which isolation level are changes made by other transactions only visible after they commit?
ARead Committed
BRepeatable Read
CRead Uncommitted
DSerializable
Describe the four standard transaction isolation levels and the types of read anomalies they prevent.
Think about how each level controls visibility of changes and what problems can happen.
You got /4 concepts.
    Explain what phantom reads are and which isolation level prevents them.
    Consider how new rows inserted by other transactions affect repeated queries.
    You got /2 concepts.