- 18
- 0
- 约1.76千字
- 约 4页
- 2018-11-24 发布于河南
- 举报
练习5答案
检索选修了1号课程,且分数最高的学生姓名
select sname
from student
where sno in(
select sno
from sc
where cno=1 and
grade=
(select max(grade)
from sc
where cno=1)
)
检索选修了“数据库”课程的学生姓名
相关子查询:
1)
select sno,sname
from student a
where 数据库 in
(
select cname
from course
where cno in
(
select cno
from sc b
where a.sno=b.sno
)
)
不相关子查询:select sname
from student
where sno in
( select sno
from sc
where cno in
( select cno
from course
where cname=数据库
)
)
3)
select sname
from student,sc,course
where student.sno=sc.sno and sc.cno=course.cno and course.cname=数据库
3.检索选修了5门以上课程的学生姓名
1)不相关子查询
select sname
from studen
原创力文档

文档评论(0)