SQL中exists

it2026-01-07  8

检索学习全部课程的学生

  换言之,在表s中找学生,在c中不存在一门课程,这个学生没有学。

   select sname from s

      where not exists  /*c表中不存在一门课程*/

         (select * from c

              where not exists /*该学生没有学*/

                        (select * from sc

                              where sc.s#=s.s# and sc.c#=c.c#))

转载于:https://www.cnblogs.com/pengdashan/archive/2013/05/18/3085945.html

相关资源:数据结构—成绩单生成器
最新回复(0)