学生关系Student (S#,SNAME, AGE, SEX);
选课关系SC(S#,C#)
课程关系Course(C#,CNAME,T#)
教师关系Teacher(T#,TNAME)
Select SNAME
from student
where not exsist (select C#
from course natural join teacher
where TNAME=‘LIU’
except
(
select C#
from SC
where SC.S#=Student.S#
));SQL基本语句
2、将每个学生所选修的课程逐一排除(except)
3、如果将1全部排除完(not exists),说明选修了LIU所教授全部课程。这样会不会清晰点呢
Select SNAME from student where not exsist
(
select C# from course natural join teacher where TNAME=‘LIU’
except
select C# from SC where SC.S#=Student.S#
);以后看不明白的代码,排排版或许就能找到主次了。
查找 没有选修LIU教师教的课程 且 不在学生选修的课程中 的学生姓名