Home >Database >Mysql Tutorial >Mysql advanced transactions

Mysql advanced transactions

高洛峰
高洛峰Original
2016-12-02 13:42:531348browse

In layman’s terms, a transaction: refers to a set of operations that are either successfully executed or not executed at all.---->Atomicity

Before all operations are completed, other sessions cannot see the process of intermediate changes. -->Isolation

Before and after the transaction, the total amount of data still matches----->Consistency

The impact of the transaction cannot be undone------>Persistence

If an error is made, the transaction is not allowed to be undone, and can only be transferred through "compensatory transactions"

Li San: --->Expenditure 500, Li San -500

Zhao Si: --- ->Received 500, Zhao Si +500

About the transaction engine:

Select innodb/bdb

Start transaction: start transaction;

Sql....

Sql... ..

Commit Submit

rollback Rollback

Note: When a transaction commit, or rollback is over

Note: There are some statements that will cause the transaction to be implicitly committed, such as start transaction

Mysql advanced transactions

A specific example of a transaction:

Mysql advanced transactions

Mysql advanced transactions

Mysql advanced transactions

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn