SQL语句 - MS-SQL Server / 基础类
将学生选课成绩从百分制改为等级制(即A、B、C、D、E五级)。
使用存储过程
SQL code:
select case
when score >=0 and score<20 then 'E'
when score >=20 and score<40 then 'D'
when score >=40 and score<60 then 'C'
when score >=60 and score<80 then 'B'
else 'A'
select case
when (score-20)/20=0 then 'e'
when (score-20)/20=1 then 'd'
when (score-20)/20=2 then 'c'
when (score-20)/20=3 then 'b'
when (score-20)/20=4 then 'a' end
from tb
SQL code:
select
case
when score score>80 then 'A'
when score score<60 then 'B'
when score score<40 then 'C'
when score score<20 then 'D'
else 'E'
end
from tb
SQL code:
select
case
when score score>=80 then 'A'
when score score>=60 then 'B'
when score score>=40 then 'C'
when score score>=20 then 'D'
else 'E'
end
from tb
楼上手误,修正
SQL code:
相关问答:
执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......
sqlserver2005 建立的数据库,与手持pda传输数据,最近突然出现无法传递数据的问题,pda端提示的错误时outofmemoryexception,但是pda上面的容量没有问题,
sqlserver的日子上的错误如下:
日期 2010-1-25 14:45: ......
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......
我想查询出每天数据的最大的一个值。表的格式如下
表名: hisdata
字段 编号 值 状态 时间
Id value state dattime
101 32.3 0 ......