新闻动态
新闻动态
NEWS INFORMATION

sql条件查询语句的简单实例

发布日期:2021-12-31 11:59 | 文章来源:站长之家
复制代码 代码如下:

//创建成绩表
create table result(
stu_id varchar2(20) not null,
china number(9,2) null,
math number(9,2) null,
english number(9,2) null
); //插入数据
insert into result values('0001',60,20,80);
insert into result values('0002',80,60,80);
insert into result values('0003',20,85,80);
select *from result; //条件查询
select stu_id,(case
when china>80 then '优秀'
when china>=60 then '及格'
when china<60 then '不及格'
end) as 语文 ,
(case
when math>80 then '优秀'
when math>=60 then '及格'
when math<60 then '不及格'
end )as 数学 ,
(case
when english>80 then '优秀'
when english>=60 then '及格'
when english<60 then '不及格'
end) as 英语
from result

版权声明:本站文章来源标注为YINGSOO的内容版权均为本站所有,欢迎引用、转载,请保持原文完整并注明来源及原文链接。禁止复制或仿造本网站,禁止在非www.yingsoo.com所属的服务器上建立镜像,否则将依法追究法律责任。本站部分内容来源于网友推荐、互联网收集整理而来,仅供学习参考,不代表本站立场,如有内容涉嫌侵权,请联系alex-e#qq.com处理。

实时开通

自选配置、实时开通

免备案

全球线路精选!

全天候客户服务

7x24全年不间断在线

专属顾问服务

1对1客户咨询顾问

在线
客服

在线客服:7*24小时在线

客服
热线

400-630-3752
7*24小时客服服务热线

关注
微信

关注官方微信
顶部
请您留言

YINGSOO400-630-3752

提交