# E071-06: Table operators in subqueries

statement ok
CREATE TABLE TABLE_E071_06_01_011 ( ID INT PRIMARY KEY, A INT );

statement ok
CREATE TABLE TABLE_E071_06_01_012 ( ID INT PRIMARY KEY, B INT );

query I
SELECT A FROM TABLE_E071_06_01_011 WHERE EXISTS ( SELECT A FROM TABLE_E071_06_01_011 UNION ALL SELECT B FROM TABLE_E071_06_01_012 )

statement ok
CREATE TABLE TABLE_E071_06_01_021 ( ID INT PRIMARY KEY, A INT );

statement ok
CREATE TABLE TABLE_E071_06_01_022 ( ID INT PRIMARY KEY, B INT );

query I
SELECT A FROM TABLE_E071_06_01_021 WHERE EXISTS ( SELECT A FROM TABLE_E071_06_01_021 UNION DISTINCT SELECT B FROM TABLE_E071_06_01_022 )

statement ok
CREATE TABLE TABLE_E071_06_01_031 ( ID INT PRIMARY KEY, A INT );

statement ok
CREATE TABLE TABLE_E071_06_01_032 ( ID INT PRIMARY KEY, B INT );

query I
SELECT A FROM TABLE_E071_06_01_031 WHERE EXISTS ( SELECT A FROM TABLE_E071_06_01_031 UNION SELECT B FROM TABLE_E071_06_01_032 )

statement ok
CREATE TABLE TABLE_E071_06_02_011 ( ID INT PRIMARY KEY, A INT );

statement ok
CREATE TABLE TABLE_E071_06_02_012 ( ID INT PRIMARY KEY, B FLOAT );

query I
SELECT A FROM TABLE_E071_06_02_011 WHERE EXISTS ( SELECT A FROM TABLE_E071_06_02_011 EXCEPT DISTINCT SELECT B FROM TABLE_E071_06_02_012 )
----

statement ok
CREATE TABLE TABLE_E071_06_02_021 ( ID INT PRIMARY KEY, A INT );

statement ok
CREATE TABLE TABLE_E071_06_02_022 ( ID INT PRIMARY KEY, B FLOAT );

query I
SELECT A FROM TABLE_E071_06_02_021 WHERE EXISTS ( SELECT A FROM TABLE_E071_06_02_021 EXCEPT SELECT B FROM TABLE_E071_06_02_022 )
