- 5
- 0
- 约5.48千字
- 约 5页
- 2017-09-09 发布于河南
- 举报
SQL考题3-无答案
Student(S#,Sname,Sage,Ssex) 学生表Course(C#,Cname,T#) 课程表SC(S#,C#,score) 成绩表Teacher(T#,Tname) 教师表问题:1、查询“001”课程比“002”课程成绩高的所有学生的学号;select a.Sid from (Select Sid,Score from SC where Cid =1)a,(Select Sid,Score from SC
Where Cid=2)b where a.Score b.Score and a.Sid =b.Sid2、查询平均成绩大于60分的同学的学号和平均成绩;select s.Sid from Student as s,SC as c
where s.Sid = c.Sid
group by s.Sid having avg(Score)603、查询所有同学的学号、姓名、选课数、总成绩;select s.Sid,s.Sname,count(c.Cid) AS 学号,sum(SC.Score)AS 成绩from Student as s,Course as c,SC
where s.Sid=SC.Sid and SC.Cid = c.Cid
group by s.Sid,s.Sname
4、查询姓“李”的老师的个数;select count
原创力文档

文档评论(0)