代码拉取完成,页面将自动刷新
-- 总结重难点
create or replace function fun_cal_point(id1 int,coursename varchar(30)) returns float as
$$
declare point float;
begin
case when coursename = 'math' then
select (
case when math <=59 then 0
when math <=69 then 0.1
when math <=79 then 0.2
when math <=89 then 0.3
when math <=100 then 0.4
else 0 end ) into point from stu where id = id1;
when coursename = 'art' then
select (
case when art <=59 then 0
when art <=69 then 0.1
when art <=79 then 0.2
when art <=89 then 0.3
when art <=100 then 0.4
else 0 end ) into point from stu where id = id1;
when coursename = 'phy' then
select (
case when phy <=59 then 0
when phy <=69 then 0.1
when phy <=79 then 0.2
when phy <=89 then 0.3
when phy <=100 then 0.4
else 0 end ) into point from stu where id = id1;
else raise notice '请输入正确的科目';
end case;
return point;
end;
$$language plpgsql;
select id,(fun_cal_point(id,'math')+fun_cal_point(id,'art')+fun_cal_point(id,'phy')) as g from stu;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。