- 检索所学课程包含学生‘张向东’所学课程的学生学号、姓名;
select distinct student.sno,student.sname
from student,sc
where student.sno = sc.sno and sc.cno in
(select sc.cno
from student,sc
where student.sno = sc.sno and student.sname = '张向东'
);
结果:
2.使用嵌套查询列出选修了“数据结构”课程的学生学号和姓名;
select sname姓名,sno学号
from student
where sno in
(select sno
from sc
where cno=
(select cno
from course
where cname='数据结构'));
结果: