新手sql问题
usemastergocreatetablescore(stuNointidentity(1,1)notnull,stuNamevarchar(10)notnull,La...
use master
go
create table score
(stuNo int identity(1,1)not null,
stuName varchar(10) not null,
LabExam int
)
go
insert score(stuName,LabExam)
select '张三',90 union
select '李斯',75 union
select '王五',40 union
select '源流',60 union
select '田七',50
select * from score
declare @n int
set nocount on ------------这句话什么意思?
while(1=1)
begin
select @n = COUNT(LabExam) from score where LabExam < 60
if(@n >0)
begin
update score set LabExam = LabExam + 2
update score set LabExam = 100 where LabExam > 100
end
else
break
end
select 姓名=stuName,成绩=case
when LabExam < 60 then 'E'
when LabExam between 60 and 69 then 'D'
when LabExam between 70 and 79 then 'C'
when LabExam between 80 and 89 then 'B'
else 'A'
end
from score
set nocount on ------------这句话什么意思? 展开
go
create table score
(stuNo int identity(1,1)not null,
stuName varchar(10) not null,
LabExam int
)
go
insert score(stuName,LabExam)
select '张三',90 union
select '李斯',75 union
select '王五',40 union
select '源流',60 union
select '田七',50
select * from score
declare @n int
set nocount on ------------这句话什么意思?
while(1=1)
begin
select @n = COUNT(LabExam) from score where LabExam < 60
if(@n >0)
begin
update score set LabExam = LabExam + 2
update score set LabExam = 100 where LabExam > 100
end
else
break
end
select 姓名=stuName,成绩=case
when LabExam < 60 then 'E'
when LabExam between 60 and 69 then 'D'
when LabExam between 70 and 79 then 'C'
when LabExam between 80 and 89 then 'B'
else 'A'
end
from score
set nocount on ------------这句话什么意思? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询