1、 查询” 01 “课程比” 02 “课程成绩高的学生的信息及课程分数
SELECT s.,c.Cname ,SC.score FROM Course c,Student s, SC ,
(select a.SId from
(select from SC where CId=’01’) as a,
(select * from SC where CId=’02’) as b
where a.score > b.score and a.sid =b.sid) as xx
where c.CId = SC.CId AND xx.SId =s.SId and SC.SId=xx.SId
2、 查询平均成绩大于等于 60 分的同学的学生编号和学生姓名和平均成绩
select V.SId,s.Sname,V.avg from (select from (select SC.,AVG(score) as avg from SC GROUP BY SId) as xx
where xx.avg >=60) V,Student s
where V.SId=s.SId
3、 查询「李」姓老师的数量
select count(*) from Teacher where Teacher.Tname LIKE ‘李%’
4、 查询学过「张三」老师授课的同学的信息
select s.* from Student s,Teacher t,Course c,SC
where s.SId=SC.SId and c.CId=SC.CId and c.TId=t.TId and t.Tname=’张三’
