首先,您是否看到此代码有问题;
SELECT num,
surname,
firstname,
ward
FROM doctor, ward WHERE num != consultant;
NUM SURNAME FIRSTNAME W
---------- ---------- ---------- -
203 Black Peter A
574 Bisi Mavis B
461 Boyne Steve B
530 Clark Nicola C
405 Mizzi Nicola A
501 Mount Mavis A
203 Black Peter A
C NAME CONSULTANT
- ---------- ----------
A Surgical 203
B Paediatric 574
C Medical 530
我期望输出是这样的;
461 Boyne Steve B
405 Mizzi Nicola A
501 Mount Mavis A
认为会显示不相等的结果,但是当我执行命令时,结果是这样的;
NUM SURNAME FIRSTNAME W
---------- ---------- ---------- -
574 Bisi Mavis B
461 Boyne Steve B
530 Clark Nicola C
405 Mizzi Nicola A
501 Mount Mavis A
203 Black Peter A
461 Boyne Steve B
530 Clark Nicola C
405 Mizzi Nicola A
501 Mount Mavis A
203 Black Peter A
NUM SURNAME FIRSTNAME W
---------- ---------- ---------- -
203 Black Peter A
574 Bisi Mavis B
461 Boyne Steve B
405 Mizzi Nicola A
501 Mount Mavis A
203 Black Peter A
我对 Oracle 很陌生,所以这可能是一个菜鸟错误,但任何帮助都会很棒。