SQL考题3-无答案.docVIP

  • 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.Sid 2、查询平均成绩大于60分的同学的学号和平均成绩;select s.Sid from Student as s,SC as c where s.Sid = c.Sid group by s.Sid having avg(Score)60 3、查询所有同学的学号、姓名、选课数、总成绩;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)

1亿VIP精品文档

相关文档