Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oracle 将其他表中缺少的数据与不存在的数据进行比较_Oracle - Fatal编程技术网

Oracle 将其他表中缺少的数据与不存在的数据进行比较

Oracle 将其他表中缺少的数据与不存在的数据进行比较,oracle,Oracle,我有两张桌子 表1 name | column animals | fish animals | cow buildings| house cars | BMW cars | Ford 表2 name | column | animals | fish | buildings| house cars | Ford 我尝试编写一个查询时,会显示缺少的2列bmw和cow,如下所示: name | col

我有两张桌子

表1

name     | column

animals  | fish
animals  | cow
buildings| house
cars     | BMW
cars     | Ford
表2

name     | column
         |
animals  | fish
         |
buildings| house

cars     | Ford
我尝试编写一个查询时,会显示缺少的2列bmw和cow,如下所示:

name     | column
animals  | Cow
Cars     | BMW
我试着写下这样的疑问:

选择t1.1列 来自表1 t1 如果不存在,则从表2中选择1,其中t1.column=t2.column

但是它给了我一个空结果,有人能修复这个查询吗?

试试这个:

Select name,column from table1
minus
select name,column from table2
SQLFiddle:

SELECT * FROM table_1 t1 WHERE 
    NOT EXISTS (SELECT 1 FROM table_2 t2 WHERE t1.column = t2.column);