【发布时间】:2023-02-01 15:18:42
【问题描述】:
在A和B两张表中,找出在A中但不在B中的ID(请使用in运算符来解决这道题) enter image description here
我是甲骨文的新手。我该如何编写这段代码。请帮助我的朋友。
【问题讨论】:
标签: oracle oracle-sqldeveloper
在A和B两张表中,找出在A中但不在B中的ID(请使用in运算符来解决这道题) enter image description here
我是甲骨文的新手。我该如何编写这段代码。请帮助我的朋友。
【问题讨论】:
标签: oracle oracle-sqldeveloper
实际上,它是NOT IN。
SQL> select a.id
2 from a
3 where a.id not in (select b.id from b where b.id is not null);
ID
----------
8
7
不过,更简单的选择是使用 minus 集合运算符:
SQL> select id from a
2 minus
3 select id from b;
ID
----------
7
8
SQL>
【讨论】: