29 Star 6 Fork 8

锐意进取/gaussdb-hcie

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
考前重难点.sql 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
锐意进取 提交于 2024-06-25 18:09 . 考前重难点
-- 总结重难点
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;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
SQL
1
https://gitee.com/maomaoking_admin/gaussdb-hcie.git
git@gitee.com:maomaoking_admin/gaussdb-hcie.git
maomaoking_admin
gaussdb-hcie
gaussdb-hcie
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385