我有以下表格和数据:此处数据的屏幕截图
course:
course# ctitle units
--------- ------------------- -----
ACCT 201 Financial Account 3
CHEM 356 Organic Chemistry 4
HIST 101 US History 5
MINS 235 Database Design 4
MINS 301 Intro to Business IS 3
MINS 350 Systems Analysis 4
PHED 434 Advanced Gym 2
class:
class# course# sec# semyr
------ ---------- ----- -----
203 ACCT 201 03 F11
204 ACCT 201 04 F11
307 MINS 301 07 F11
418 MINS 235 04 F11
438 MINS 350 01 F11
624 PHED 434 02 F11
student:
sid sname major
--- ---------- ----------
1 Bob MINS
2 Mary POMG
3 Joe MGMT
4 Sue MKTG
5 Jim ACCT
class_student:
class sid grade
----- ---- -----
203 2 B
203 5 D
204 1 C
204 4 C
307 1 B
307 2 B
307 4 A
418 1 A
418 2 B
418 5 C
438 1 B
438 4 C
634 5 F
grade:
grade grade_pts
----- ---------
A 4
B 3
C 2
D 1
F 0
当我运行以下查询时:
SELECT *
FROM STUDENT
WHERE SID NOT IN
( SELECT SID
FROM CLASS_STUDENT
WHERE GRADE IN ('A' , 'B')
)
ORDER BY SID;
我认为甲骨文会产生这个输出。
sid sname major
--- ----- -----
1 bob mins
4 sue mktg
5 jim acct
5 jim acct
5 jim acct
我想了解 NOT IN 逻辑运算符的工作原理。运算符如何NOT IN
在上述查询中工作以生成输出?