4.有一张表,里面有3个字段:语文,数学,英语。其中有3条记录分别表示语文70分,数学80分,英语58分,请用一条sql语句查询出这三条记录并按以下条件显示出来(并写出您的思路):
大于或等于80表示优秀,大于或等于60表示及格,小于60分表示不及格。
显示格式:
语文 数学 英语
及格 优秀 不及格 这里是数据库操作
create table t4(
yw number,
sx number,
yy number);insert into t4 values(70,80,58);select (case when t4.yw>=80 then '优秀'
when t4.yw>=60 then '及格'
else '不及格' end)as 语文,
(case when t4.sx>=80 then '优秀'
when t4.sx>=60 then '及格'
else '不及格' end)as 数序,
(case when t4.yy>=80 then '优秀'
when t4.yy>=60 then '及格'
else '不及格' end)as 英语
from t4;
这是我写的 但是效率低 请教各位 怎么写 能效率高点算法数据库sql
大于或等于80表示优秀,大于或等于60表示及格,小于60分表示不及格。
显示格式:
语文 数学 英语
及格 优秀 不及格 这里是数据库操作
create table t4(
yw number,
sx number,
yy number);insert into t4 values(70,80,58);select (case when t4.yw>=80 then '优秀'
when t4.yw>=60 then '及格'
else '不及格' end)as 语文,
(case when t4.sx>=80 then '优秀'
when t4.sx>=60 then '及格'
else '不及格' end)as 数序,
(case when t4.yy>=80 then '优秀'
when t4.yy>=60 then '及格'
else '不及格' end)as 英语
from t4;
这是我写的 但是效率低 请教各位 怎么写 能效率高点算法数据库sql
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货