markdown 格式测试

Q1: before 与 afer 的而区别在哪?

Q2: 如何预防"爆仓"?

Q3: 在购买量 much > 库存量 num时, 把much自动改为num?

-- 在t2的基础上, 完成 much 与 num 的判断
drop trigger t5 if exists;
delimiter //
create trigger t5
after
inset
on ord
-- 声明变量用来存储查询到的剩余库存num值
declare rNum int;
for each row
begin
-- 查询到剩余库存
select num INTO rNum from goods where gid=NEW.gid;
-- if much > num 就爆仓了呀
if NEW.much > rNum 


update goods set num=num-NEW.much where gid=NEW.gid
end //
delimiter ;

猜你喜欢

转载自www.cnblogs.com/chenjieyouge/p/11617400.html