一sql 语句

三个表

学生S:
学号   姓名
SNO    SNAME

课程C:
课程号  课程名
CNO     CNAME

学生选课S-C
学号    课程号      成绩
SNO     CNO         SCORE

填空题,在(1)(2)(3)中填入相应的语句
得出选了所有课程的学生的名字
select sname
from s
where (1)
     (select *
      from c
      where (2)
            (select *
             from s-c
             where (3)
             )
      )

result:

(1) not exists
(2) not exists
(3) sno=s.sno and cno=c.cno

select sname
from s
where not exists
     (select *
      from c
      where not exists
            (select *
             from s-c
             where (sno=s.sno and cno=c.cno)
             )
      )

from a csdn' question

你可能感兴趣的