检索所学课程包含学生‘刘晨’所学课程的学生学号、姓名;
select student.sno,student.sname
from student
where sno in(
from sc
where sc.cno in(
select sc.cno
from sc,student
where sc.sno=student.sno and student.sname='刘晨'))
先选出刘晨所选修课程的课程号,再通过选修课程号选择出选择了这些课程的学生学号,再通过学号查询出学生的信息
检索所学课程包含学生‘刘晨’所学课程的学生学号、姓名;
select student.sno,student.sname
from student
where sno in(
from sc
where sc.cno in(
select sc.cno
from sc,student
where sc.sno=student.sno and student.sname='刘晨'))
先选出刘晨所选修课程的课程号,再通过选修课程号选择出选择了这些课程的学生学号,再通过学号查询出学生的信息