READ COMMITTED
- SQL course
- Advanced
- Lesson 56/81
- 4 min
Learn the middle level and non-repeatable reads.
READ COMMITTED
READ COMMITTED reads only committed data. It prevents dirty reads.
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;No dirty read, non-repeatable read exists.
READ COMMITTED — details
Non-repeatable read: reading the same row twice may give different values. Another transaction may commit in between.
For example, reading the same account's balance at the start and end of a report can give two different numbers, making the report inconsistent.
Practice READ COMMITTED
Set the isolation level to READ COMMITTED.
Starter code
-- mid level
SETSample solution
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;Expected output
İzolasyon ayarlandı
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 READ COMMITTED: match the terms
| Term | Meaning |
|---|---|
dirty read |
prevented |
non-repeatable |
exists |
committed |
read |
mid |
balanced |
2 READ COMMITTED
SET TRANSACTION ISOLATION LEVEL ____
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
Explanation: READ COMMITTED is the right answer.
3 What does READ COMMITTED prevent?
- Phantom read
- All problems
- Dirty read Correct answer
- Deadlock
Explanation: READ COMMITTED prevents dirty reads.