1.查询出编号为01的课程比02的课程的成绩高的人
select a.s_id,a.s_core s1,b.s_core s2,t.s_name FROM
(select c_id,s_core,s_id from score where c_id='01')as a
INNER JOIN
(select c_id,s_core,s_id from score where c_id='02') as b
on a.s_id=b.s_id
INNER JOIN student t on a.s_id=t.s_id
where a.s_core>b.s_core
2.平均成绩大于60的学生编号
SELECT s_id,s_core from score group by s_id HAVING s_core >60
3.查询所有学生的,学号,姓名,选课数,总成绩
select a.s_name,a.s_id,COUNT(b.c_id),SUM(b.s_core) from student a LEFT JOIN score b on a.s_id=b.s_id GROUP BY b.s_id
4.查找某个姓氏老师的个数
5.选出选择张三老师课程的人