SQL查詢選修了全部課程的學生姓名解析

2021-07-07 07:43:16 字數 589 閱讀 9508

查詢選修le全部課程的學生姓名

select sname

from student

where not exists

(select *

from course

where not exists

(select *

from sc

where sno =student.sno

and cno=course.cno)

第一問:兩個not exists表示雙重否定:沒有乙個選了課的學生沒有選course表裡的課程

select sname

from student

where not exists /*沒有乙個學生滿足以下的條件*/

(select * from course

where not exists /*什麼條件呢?沒有選過course表裡的課*/

(select * from sc

where sno =student.sno /*這裡兩個=分別指對應的關係,表示選過課並且是

and cno=course.cno)  course的課,只不過用not exists否定掉了*/

SQL查詢選修了全部課程的學生姓名

1.select 2.sname 3.from 4.not exists 5.select from course where not exists 6.select from sc where sno student.sno and cno course.cno 對於這個題目我解釋一下 not e...

查詢選修了全部課程的學生姓名

select sname from student where not exists select from course where not exists select from sc where sno student.sno and cno course.cno 我的理解是 這是乙個相關子查詢...

查詢選修了全部課程的學生姓名

1.select 2.sname 3.from s 5.where notexists 6.select from course where notexists 7.select from sc where sno student.sno and cno course.cno where後面的 no...