48
请将学生成绩查询出来,并且显示出学生编号、名称、班级、性别、学科名称、是否选修
select stuNO as 学生编号,stuName as 学生名称,className as 班级名称,stuSex as 性别,couName as 学科名称,xx as 是否选修 from stuMark
left join stu on stumark.stuid=stu.stuid
left join cou on stumark.couID=cou.couID
给五班的学生进行必修课的分科排名
select stuNO as 学生编号,stuName as 学生名称,className as 班级名称,stuSex as 性别,couName as 学科名称,xx as 是否选修,score as 分数 from stuMark
left join stu on stumark.stuid=stu.stuid
left join cou on stumark.couID=cou.couID where className=‘五班’ and xx=‘必修’ order by couName, score desc
选出男生的成绩
select stuNO as 学生编号,stuName as 学生名称,className as 班级名称,stuSex as 性别,couName as 学科名称,xx as 是否选修,score as 分数 from stuMark
left join stu on stumark.stuid=stu.stuid
left join cou on stumark.couID=cou.couID where stusex=‘男’
每个学生的总分是多少?最高的是谁?
select stuID as 学生编号,SUM(score) 总分 from stuMark group by stuMark.stuID order by SUM(score)
每个学生的平均分是多少?最高的是谁?
select stuID as 学生编号,avg(score) 总分 from stuMark group by stuMark.stuID order by avg(score)
如果60分是及格分,有学生不及格吗?从成绩找到这名同学
select stuNO as 学生编号,stuName as 学生名称,className as 班级名称,stuSex as 性别,couName as 学科名称,xx as 是否选修,score as 分数 from stuMark
left join stu on stumark.stuid=stu.stuid
left join cou on stumark.couID=cou.couID where score<60
如果80分是优秀分,找到平均分到达优秀的学生
select stuID as 学生编号,avg(score) 总分 from stuMark group by stuMark.stuID having avg(score)>80