There are four isolation levels for transactions in the database, with levels from low to High: READ UNCOMMITTED, Read committed, Repeatable read, and serializable four. These four levels can solve the problems of dirty reading, non-repeatable reading, and Phantom reading one after the other.
If the current isolation level is read UNCOMMITTED, a dirty read may occur, and you can read the temporary write data that has not yet been committed.
If the current isolation level is read Committed, you can avoid dirty reads, but may cause non-repeatable reads, which is the data consistency and integrity that occurs when two transactions modify the same data at the same time. The default level for most databases is read committed, such as SQL Server and Oracle.
If the current isolation level is repeatable read, you can avoid non-repeatable reads, that is, when the same data is currently read by two or more transactions, the database selects the first transaction that accesses the data to be readable and writable, and the second and subsequent transactions are read-only. Although this avoids non-repeatable reads, when a transaction a two reads the same data, if there are other changes to the data during the period of the database-readable writable transaction, the result of two read data from transaction A is very likely to be inconsistent, resulting in a phantom read.
Serializable the highest level of transaction isolation in the database at serialization time, at which the transactions are executed in order to avoid dirty reads, non-repeatable reads, and Phantom reads, but with a high cost and low performance.
Simple summary of Isolation level for database transactions