CMD实现数据库实现事务

1.创建数据库:

  create database test0922;

  use test0922;

 

 

 2.创建数据表测试事务:

  create table account(

  -> id int primary key auto_increment,
  -> name varchar(20),
  -> money float);

 

 3.向表中插入数据:

  insert into account values(1,'A',1000),(2,'B',599),(3,'C',900);

 

4.开启事务:start transaction;

5.更改数据:

  

 

 6.数据回滚:

 7.事务手动提交commit:

 

posted @ 2019-09-22 10:09  醉醺醺的  阅读(316)  评论(0编辑  收藏  举报