| 1 |
CREATE TABLE tx1 (c1 int, c2 varchar(30)); |
| 2 |
CREATE TABLE tx2 (c1 int, c2 varchar(30)); |
| 3 |
CREATE TABLE tx3 (c1 int, c2 varchar(30)); |
| 4 |
INSERT INTO tx1 VALUES (1, 'jim'); |
| 5 |
INSERT INTO tx1 VALUES (2, 'menny'); |
| 6 |
INSERT INTO tx1 VALUES (3, 'linda'); |
| 7 |
INSERT INTO tx2 VALUES (1, 'jim'); |
| 8 |
INSERT INTO tx2 VALUES (2, 'kris'); |
| 9 |
INSERT INTO tx2 VALUES (3, 'shory'); |
| 10 |
INSERT INTO tx3 VALUES (1, 'jim'); |
| 11 |
INSERT INTO tx3 VALUES (2, 'kris'); |
| 12 |
INSERT INTO tx3 VALUES (3, 'linda'); |
| 13 |
# |
| 14 |
# test when sql_mode is not oracle |
| 15 |
# |
| 16 |
SELECT c2 FROM tx1 EXCEPT SELECT c2 from tx2; |
| 17 |
c2 |
| 18 |
menny |
| 19 |
linda |
| 20 |
SELECT c2 FROM tx1 MINUS SELECT c2 from tx2; |
| 21 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT c2 from tx2' at line 1 |
| 22 |
create table MINUS (a int); |
| 23 |
drop table MINUS; |
| 24 |
# |
| 25 |
# test when sql_mode is oracle |
| 26 |
# |
| 27 |
SET sql_mode=ORACLE; |
| 28 |
SELECT c2 FROM tx1 MINUS SELECT c2 from tx2; |
| 29 |
c2 |
| 30 |
menny |
| 31 |
linda |
| 32 |
SELECT c2 FROM tx1 MINUS SELECT c2 from tx2 MINUS SELECT c2 from tx3; |
| 33 |
c2 |
| 34 |
menny |
| 35 |
SELECT c2 FROM tx1 MINUS SELECT c2 from tx2 EXCEPT SELECT c2 from tx3; |
| 36 |
c2 |
| 37 |
menny |
| 38 |
SELECT c2 FROM tx1 MINUS SELECT c2 from tx2 UNION SELECT c2 from tx3; |
| 39 |
c2 |
| 40 |
menny |
| 41 |
linda |
| 42 |
jim |
| 43 |
kris |
| 44 |
create table MINUS (a int); |
| 45 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MINUS (a int)' at line 1 |
| 46 |
DROP TABLE tx1; |
| 47 |
DROP TABLE tx2; |
| 48 |
DROP TABLE tx3; |