黑马视频—循环
--不及格人数超过总人数一般,则给每人加2分,直到不及格人数小于一半为止
--1.计算总人数
declare @count=(select count(*) from TblScore)
--2.英语不及格人数
declare @loser=(select count(*) from TblScoe where tenglish<60)
print @count/2
while @loser>@count/2
begin
update TblScore set tenglish=tenglish+2 where tengish<60
--3.每次提分完毕后重新计算当前不及格的人数
@loser=(select count(*) from TblScoe where tenglish<60)
end
print ceiling(11/2.0)
print floor(11/2.0)