事务处理
事务处理的术语
// 开启事务 start transaction; select * from ordertotal; delete from ordertotals; rollback; // 回退 start transaction; delete from ordertime order_num=20011; delete from orders where order_num=20011; commit;// 提交 提交之后再回退就不行了 start transaction; delete from orderitems where order_num = 2010;
控制事务处理
savepoint deletel; // 保留点 delete from orders where order_num=2010; rollback to deletel;
更改默认的提交行为
insert into orders values (2030,'2013-9-12',12000); set autocommit=0; // 针对连接 insert into orders values (2050,'2013-9-12',1400); commit;