SQL: READ COMMITTED lets the same query return different rows twice

At the default isolation level of most engines, each statement sees a fresh snapshot. A value read at the start of a transaction can be different when read again at the end - which breaks any check-then-act written across two statements.

Full code & output

This topic is available to PRO members.

Sign in Create a free account

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-25