求此题简单解法

来源:百度知道 编辑:UC知道 时间:2024/04/29 23:39:57

-- 两种方法
-- 第一种使用if

start:
if (select avg(LabExam) from 表名) <85
update 表名 set LabExam
= case
when LabExam>=90 then LabExam
when LabExam>=80 then LabExam+1
when LabExam>=70 then LabExam+2
when LabExam>=60 then LabExam+3
else LabExam+5 end
if (select avg(LabExam) from 表名) <85
goto start

-- 第二种使用while

while (select avg(LabExam) from 表名)<85
update 表名 set LabExam
= case
when LabExam>=90 then LabExam
when LabExam>=80 then LabExam+1
when LabExam>=70 then LabExam+2
when LabExam>=60 then LabExam+3
else LabExam+5 end