0
0
SQLquery~20 mins

Transaction isolation levels in SQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Transaction Isolation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Read Phenomena in Isolation Levels

Which transaction isolation level prevents dirty reads but allows non-repeatable reads and phantom reads?

ARead Committed
BRead Uncommitted
CRepeatable Read
DSerializable
Attempts:
2 left
💡 Hint

Think about which isolation level only blocks reading uncommitted data but does not lock rows for repeatable reads.

query_result
intermediate
2:00remaining
Output of Concurrent Transactions under Repeatable Read

Consider two transactions running concurrently under Repeatable Read isolation level. Transaction 1 reads a row, then Transaction 2 updates that row and commits. Transaction 1 reads the same row again.

What will Transaction 1 see on the second read?

AThe updated value committed by Transaction 2
BAn error due to concurrent update
CThe original value from the first read
DNo row found (deleted or locked)
Attempts:
2 left
💡 Hint

Repeatable Read guarantees the same data for repeated reads within the same transaction.

📝 Syntax
advanced
2:00remaining
Correct Syntax to Set Serializable Isolation Level

Which SQL statement correctly sets the transaction isolation level to Serializable for the current session in standard SQL?

ABEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
BSET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
CALTER SESSION SET ISOLATION LEVEL = SERIALIZABLE;
DSET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
Attempts:
2 left
💡 Hint

Focus on the standard SQL syntax for setting isolation level.

optimization
advanced
2:00remaining
Choosing Isolation Level for Maximum Concurrency

You want to maximize concurrency in a database system but still avoid dirty reads. Which isolation level should you choose?

ARead Uncommitted
BRead Committed
CRepeatable Read
DSerializable
Attempts:
2 left
💡 Hint

Consider which isolation level balances data accuracy and concurrency.

🔧 Debug
expert
2:00remaining
Diagnosing Phantom Reads in Repeatable Read

In a database using Repeatable Read isolation level, a transaction reads a set of rows matching a condition twice and sees different rows the second time (phantom reads). What is the most likely cause?

ARepeatable Read does not lock range scans, allowing phantom rows
BThe database uses snapshot isolation which does not prevent phantom reads
CThe transaction did not commit before the second read
DThe isolation level was downgraded to Read Committed automatically
Attempts:
2 left
💡 Hint

Think about what Repeatable Read guarantees and what it does not.