关系 Student,SC,Course,Teacher
Student(Snum,Sname,Ssex,Sage)
SC(Cnum,Cname,Tnum)
Course(Cnum,Cname,Tnum)
select * from Student
where Snum in
(
select distinct Snum from SC x
where not exists
(
select * from SC y
where y.Snum='S001' and not exists
(
select * from SC z
where z.Cnum=y.Cnum and z.Snum=x.Snum
)
)
)
本文介绍了一个SQL查询案例,通过使用嵌套子查询和NOT EXISTS条件,来找出数据库中未选修指定学生(例如'S001')所有课程的其他学生。这个查询涉及到了Student、SC和Course三个表的关系操作。
4812

被折叠的 条评论
为什么被折叠?



