1、① 查询不同课程成绩相同的学生的学号、课程号、学生成绩(自身连接)select a.* from sc a ,sc b where a.score=b.score and a.cno<>b.cno

3、① 查询不及格的课程,并按课程成绩降序排列select sc.sno,cname,scorefrom sc,coursewhere sc.cno=course.cno and sc.score<60order by score desc

5、① 查询课程名称为“Oracle”,且分数低于60 的学生姓名和分数select sname,scorefrom student,sc,coursewhere sc.sno=student.sno and sc.cno=course.cno and course.cname='Oracle' and scourse.score<60

7、① 查询出只选修了一门课程的全部学生的学号和姓名select student.sno,snamefrom studentleft join sc on student.sno=sc.snogroup by student.sno,snamehaving count(cno)=1注意:having count(cno)不能写成having count(*),因为没有成绩的学生信息也有一行数据。也可以:select student.sno,snamefrom student,scwhere student.sno=sc.snogroup by student.sno,snamehaving count(cno)=1

9、① 查询不同老师所教不同课程平均分从高到低显示,平均分最多保留两位小数。select sc.cno荑樊综鲶,teacher.tname,cname,round(avg(score),2) as 平均成绩from course,sc,teacherwhere course.cno=sc.cno and course.tno=teacher.tnogroup by teacher.tname,sc.cno,cnameorder by avg(score) desc
