题库 软件开发 题目列表 有一张学生成绩表sc(sno 学号,class 课程,score...
单选题
有一张学生成绩表sc(sno 学号,class 课程,score 成绩),示例如下:

请问哪个语句可以查询出每个学生的英语、数学的成绩(行转列,一个学生输出一行记录,比如输出[1, 89, 90])?
A.

select sno,class,score from sc where class in('english','math')

B.
select sno,
if(class='english',score,0),
if(class='math',score,0)
from sc
where class in('english','math')
C.
select sno,
case when class='english' then score else 0 end ,
case when class='math' then score else 0 end
from sc
where class in('english','math')
D.
select sno,
sum(if(class='english',score,0)) as english,
sum( if(class='math',score,0) ) as math
from sc
where class in('english','math')
group by sno
题目信息
校招真题
-
正确率
0
评论
10
点击