Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Simple steps for MySQL transaction execution

2025-02-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following is mainly to bring you simple steps of MySQL transaction execution, I hope these words can bring you practical use, this is also the main purpose of my editing MySQL transaction execution simple steps this article. Okay, no more nonsense, let's go straight to the following.

A transaction can consist of a series of sql statements, and its execution is atomic.

1. Atomicity:

Contains multiple sql statements that either execute successfully or fail to execute successfully

2. Rollback:

Go back to the original unexecuted state

Create a table first

create table user(id int primary key auto_increment,name char(32),balance int);

insert data

insert into user(name,balance)values('wsb',1000),('egon',1000),('ysb',1000);

began to implement

start transaction; update user set balance=900 where id=1;update user set balance=1010 where id=2;update user set balance=1090 where id=3;commit; write MySQL, so that you really cannot rollback

rollback; If there is no commit, then executing this statement will roll back to the original unexecuted state

For the above simple steps on MySQL transaction execution, do you think it is very helpful? If you need to know more, please continue to pay attention to our industry information, I believe you will like these contents.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report