MySQL高级转账案例

-- 任务 2-1:使用 update 语句实现转账操作,实现账号 1 向账号 2 转账 100 元。
create table t_act(
acton int not null,
balance int not null
);
insert into t_act(acton,balance)
values(1,500),
(2,100);
update t_act set balance=balance-100 where acton=1;
update t_act set balance=balance+100 where acton=2;
 
 
 
 
posted @ 2020-03-09 13:17  人工苗  阅读(245)  评论(0)    收藏  举报