update students
set grade = (
select grade from
(
select id,
case when current_credits > 90 then 'a'
when current_credits > 80 then 'b'
when current_credits > 70 then 'c'
else 'd' end grade
from students
) a
where a.id = students.id
)
/
set grade = (
select grade from
(
select id,
case when current_credits > 90 then 'a'
when current_credits > 80 then 'b'
when current_credits > 70 then 'c'
else 'd' end grade
from students
) a
where a.id = students.id
)
/
本文介绍了一种基于当前学分更新学生等级的方法。通过使用条件语句判断学生的当前学分,并据此将其成绩分为A、B、C、D四个等级。具体实现上采用了一个内嵌的子查询来匹配每个学生的ID并确定其相应的等级。
3238

被折叠的 条评论
为什么被折叠?



