6. Affairs
- Transactions are only supported for databases or tables using the Innodb database engine in MySQL
- Transaction processing can be used to maintain the integrity of the database, ensuring that batches of SQL statements are either all executed or not executed at all
- Transactions are used to manage insert, update, delete statements
6.1 Characteristics of transactions:
- 1. The atomicity of transactions: a set of transactions, either successful or withdrawn.
- 2. Stability : If there is illegal data (foreign key constraints, etc.), the transaction is withdrawn.
- 3. Isolation: Transactions run independently. If the result of a transaction affects other transactions, then other transactions will be withdrawn. 100% isolation of transactions at the expense of speed.
- 4. Reliability: After the software and hardware crash, the InnoDB data table driver will use the log file to reconstruct and modify it.
Use transactions in the Mysql console to operate
begin;
insert into a(a) values(555);
rollback;
Of course, if the above data is OK, just enter the commit to submit the command;