1create table t1 (a int, b blob) engine=MyISAM; 2create table t2 (c int, d blob) engine=MyISAM; 3create table t3 (e int, f blob) engine=MyISAM; 4insert into t1 values (5,5),(6,6); 5insert into t2 values (2,2),(3,3); 6insert into t3 values (1,1),(3,3); 7set SQL_MODE=ORACLE; 8(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4); 9a b 104 4 113 3 12explain extended 13(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4); 14id select_type table type possible_keys key key_len ref rows filtered Extra 151 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 162 UNION t2 ALL NULL NULL NULL NULL 2 100.00 173 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 184 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used 19NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL 20Warnings: 21Note 1003 (/* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") intersect (/* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") union (/* select#4 */ select 4 AS "4",4 AS "4") 22(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4); 23e f 245 5 253 3 266 6 274 4 28explain extended 29(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4); 30id select_type table type possible_keys key key_len ref rows filtered Extra 311 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 322 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00 333 UNION t1 ALL NULL NULL NULL NULL 2 100.00 344 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used 35NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL 36Warnings: 37Note 1003 (/* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") intersect (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") union (/* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#4 */ select 4 AS "4",4 AS "4") 38create table t12(c1 int); 39insert into t12 values(1); 40insert into t12 values(2); 41create table t13(c1 int); 42insert into t13 values(1); 43insert into t13 values(3); 44create table t234(c1 int); 45insert into t234 values(2); 46insert into t234 values(3); 47insert into t234 values(4); 48select * from t13 union select * from t234 intersect select * from t12; 49c1 501 512 52set SQL_MODE=default; 53drop table t1,t2,t3; 54drop table t12,t13, t234; 55create table t1 (a int, b blob) engine=MyISAM; 56create table t2 (c int, d blob) engine=MyISAM; 57create table t3 (e int, f blob) engine=MyISAM; 58insert into t1 values (5,5),(6,6); 59insert into t2 values (2,2),(3,3); 60insert into t3 values (1,1),(3,3); 61set SQL_MODE=ORACLE; 62select a,b from t1 union all select c,d from t2 intersect select e,f from t3 union all select 4,'4' from dual; 63a b 644 4 653 3 66explain extended 67select a,b from t1 union all select c,d from t2 intersect select e,f from t3 union all select 4,'4' from dual; 68id select_type table type possible_keys key key_len ref rows filtered Extra 691 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 702 UNION t2 ALL NULL NULL NULL NULL 2 100.00 713 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 724 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used 73NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL 74Warnings: 75Note 1003 /* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" intersect /* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" union all /* select#4 */ select 4 AS "4",'4' AS "4" 76select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual; 77a b 783 3 794 4 80explain extended 81select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual; 82id select_type table type possible_keys key key_len ref rows filtered Extra 831 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 842 UNION t2 ALL NULL NULL NULL NULL 2 100.00 853 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 864 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used 87NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL 88Warnings: 89Note 1003 /* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" intersect all /* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" union all /* select#4 */ select 4 AS "4",'4' AS "4" 90select e,f from t3 intersect select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; 91e f 925 5 933 3 946 6 954 4 96explain extended 97select e,f from t3 intersect select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; 98id select_type table type possible_keys key key_len ref rows filtered Extra 991 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 1002 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00 1013 UNION t1 ALL NULL NULL NULL NULL 2 100.00 1024 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used 103NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL 104Warnings: 105Note 1003 /* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" intersect /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" union all /* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#4 */ select 4 AS "4",'4' AS "4" 106select e,f from t3 intersect all select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; 107e f 1083 3 1095 5 1106 6 1114 4 112explain extended 113select e,f from t3 intersect all select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; 114id select_type table type possible_keys key key_len ref rows filtered Extra 1151 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 1162 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00 1173 UNION t1 ALL NULL NULL NULL NULL 2 100.00 1184 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used 119NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL 120Warnings: 121Note 1003 /* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" intersect all /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" union all /* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#4 */ select 4 AS "4",'4' AS "4" 122set SQL_MODE=default; 123drop table t1,t2,t3; 124set SQL_MODE=oracle; 125select * from t13 union select * from t234 intersect all select * from t12; 126ERROR 42S02: Table 'test.t13' doesn't exist 127set SQL_MODE=default; 128