当前位置:首页 » 编程语言 » sql大于60及格小于60不及格
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

sql大于60及格小于60不及格

发布时间: 2022-06-15 04:17:03

⑴ 求sql语句

select case when 语文<60 then 不及格 else case when 语文>=80 then 优秀 else 及格 end end as 语文,case when 数学<60 then 不及格 else case when 数学>=80 then 优秀 else 及格 end end as 数学,case when 英语<60 then 不及格 else case when 英语>=80 then 优秀 else 及格 end end as 英语 from
(select max(语文) as ,语文 , max(数学) as 数学, max(英语) as 英语 from table)

⑵ 求sql语句 60分以下显示为不及格

用case语句
select
姓名,
case
分数
when
分数<60
then
"不及格"
else
分数
end
from
table

⑶ sql2000 大于60分不变,小于60替换成不及格

SELECT
NAME,SCORE=
CASE
WHEN
SCORE<60
THEN
'不及格'
else
SCORE
END
FROM
CHANGE
或者:
SELECT
NAME,SCORE=
CASE
WHEN
SCORE<60
THEN
'不及格'
when
SCORE>=60
then
SCORE
END
FROM
CHANGE

⑷ sql把student表中大于85分的显示为优,75-84为良,60-74及格,小于60显示为不及格,空的显示为缺考

select name,chengji,(case when chengji >85 then '优'
when chengji between 75 and 84 then '良'
when chengji between 60 and 74 then '及格'
when chengji <60 then '不及格'
when chengji is null then '缺考' end) 分数等级评价
from student;
运行结果:
name 分数 分数等级评价
小红 55 不及格
王一 89 优

⑸ 如何用sql语句查出学生表成绩小于60为不及格60-80为良好80-90为优秀

select name,case when 成绩<60 then 不及格 when 成绩>=60 and 成绩<80 then 良好 when 成绩>=0 and 成绩<90 then 优秀 end as 成绩情况 ,from 表名。

注意,在输入sql语句的时候,要在英文环境下输入。否则可能会出现代码不识别。