创建存储过程体功能为让某部门员工的支出减少,最后调试调用市场部,减少50
employees员工表(工号,员工部门编号)
departments部门表(部门编号,部门名称)
salary工资表(工号,支出,收入)
delimiter $$
create procedure yggl_lyf(in bm char(20),in zc float(8,2))
begin
update salary s,(select 员工编号 from employees,departments where employees.员工部门号=departments.部门编号 and 部门名称='bm') e
set 支出=支出-zc
where s.员工编号=e.员工编号;
end $$
delimiter ;
call yggl_lyf('市场部',50);
update salary set 支出=支出-zc where 员工编号 in (
select 员工编号 from employees,departments where employees.员工部门号=departments.部门编号 and 部门名称=bm
)
您的问题已经有小伙伴解答了,请点击【采纳】按钮,采纳帮您提供解决思路的答案,给回答的人一些鼓励哦~~
ps:开通问答VIP,享受5次/月 有问必答服务,了解详情↓↓↓
【电脑端】戳>>> https://vip.csdn.net/askvip?utm_source=1146287632
【APP 】 戳>>> https://mall.csdn.net/item/52471?utm_source=1146287632