本帖最后由 lanyanse0504 于 2011-03-26 21:14:30 编辑

解决方案 »

  1.   

    其实group by S# having count(SC.C#)=(select count(C#) from Course,Teacher  where Teacher.T#=Course.T# and  Tname='叶平'))
    第五行的意思是
    选修课的总数等于叶平所选择的课程数
    即是叶平所选修改的所有课程
      

  2.   

    是这样的,叶平所教的课程有许多吧,不止一条吧,数据库的连接是一行对应一行的,
    其实可以转化为双重否定来理解!
    不存在这样一个课程,叶平执教这个课程,而其它同学没有选修!
    select S#,Sname      --1
    from Student
    where not exists(select c# from SC where student.S#=SC.S#
               and Not exists(select C# from Teacher inner join course where SC.C#=course.C# and                    Teacher.T#=Course.T# and Teacher.Tname='叶平') )