sql server 实验9 连接查询

 时间:2024-10-13 04:48:13

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

sql server 实验9 连接查询

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

sql server 实验9 连接查询

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

sql server 实验9 连接查询

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

sql server 实验9 连接查询

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

sql server 实验9 连接查询
  • Word样式的使用方法
  • html中lang属性的用法及作用
  • Java怎么设置绝对布局器
  • Word里如何在文档资料中添加多级列表?
  • 怎么在Excel中使用ISODD函数
  • 热门搜索
    达美旅游网 南宁周边旅游景点大全 山西五台山旅游攻略 湖南省旅游局官方网站 西中岛旅游 连州旅游 全国各地旅游景点 天门山旅游攻略 酷讯旅游 西安旅游公司