118 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			118 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| drop table if exists t1,t2,t3,t4;
 | |
| create table t1(c1 int primary key, c2 int);
 | |
| create table t2(c1 int primary key, c2 int);
 | |
| create table t3(c1 int, c2 int primary key);
 | |
| create table t4(c1 int primary key, c2 int);
 | |
| insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
 | |
| insert into t2 values(0,0),(2,2),(4,4),(6,6);
 | |
| insert into t3 values(1,1),(3,3),(5,5),(7,7);
 | |
| insert into t4 values(1,0),(2,0),(3,1),(4,1);
 | |
| select * from t1 except select * from t1;
 | |
| c1	c2
 | |
| select * from t1 except all select * from t1;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select * from t1' at line 1
 | |
| select * from t1 except select * from t2;
 | |
| c1	c2
 | |
| 1	1
 | |
| 3	3
 | |
| 5	5
 | |
| select * from t1 except all select * from t2;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select * from t2' at line 1
 | |
| select * from t1 except select * from t3;
 | |
| c1	c2
 | |
| 2	2
 | |
| 4	4
 | |
| select * from t1 except all select * from t3;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select * from t3' at line 1
 | |
| select * from t1 except select 1,1 from t1;
 | |
| c1	c2
 | |
| 2	2
 | |
| 3	3
 | |
| 4	4
 | |
| 5	5
 | |
| select * from t1 except all select 1,1 from t1;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select 1,1 from t1' at line 1
 | |
| select * from t2 except select * from t3;
 | |
| c1	c2
 | |
| 0	0
 | |
| 2	2
 | |
| 4	4
 | |
| 6	6
 | |
| select * from t2 except all select * from t3;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select * from t3' at line 1
 | |
| (select * from t2) except (select * from t2 where false);
 | |
| c1	c2
 | |
| 0	0
 | |
| 2	2
 | |
| 4	4
 | |
| 6	6
 | |
| (select * from t2) except all (select * from t2 where false);
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all (select * from t2 where false)' at line 1
 | |
| (select * from t2 where false) except (select * from t2);
 | |
| c1	c2
 | |
| (select * from t2 where false) except (select * from t2 where false);
 | |
| c1	c2
 | |
| select c2  from t4 except select 1 from t4;
 | |
| c2
 | |
| 0
 | |
| select c2  from t4 except all select 1 from t4;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select 1 from t4' at line 1
 | |
| select c2  from t4 except select 0 from t4;
 | |
| c2
 | |
| 1
 | |
| select c2  from t4 except select c2  from t4;
 | |
| c2
 | |
| select c2  from t4 except select distinct c2  from t4;
 | |
| c2
 | |
| select distinct c2  from t4 except select distinct c2  from t4;
 | |
| c2
 | |
| select distinct c2  from t4 except all select distinct c2  from t4;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select distinct c2  from t4' at line 1
 | |
| select distinct c2  from t4 except select c2  from t4;
 | |
| c2
 | |
| select distinct c2  from t4 except all select c2  from t4;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select c2  from t4' at line 1
 | |
| select 0 from t4 except select c2 from t4;
 | |
| 0
 | |
| select 1 from t4 except select 0 from t4;
 | |
| 1
 | |
| 1
 | |
| select 1 from t4 except all select 0 from t4;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select 0 from t4' at line 1
 | |
| (select * from t4 except (select * from t4 where c1=1) )except (select * from t4 where c1=2);
 | |
| c1	c2
 | |
| 3	1
 | |
| 4	1
 | |
| select * from t4 except (select * from t4 where c1=1) except (select * from t4 where c1=3);
 | |
| c1	c2
 | |
| 2	0
 | |
| 4	1
 | |
| select * from t4 except select 1,0 from t4 except select 3,1 from t4;
 | |
| c1	c2
 | |
| 2	0
 | |
| 4	1
 | |
| (select * from t4 where false) except (select * from t4 where false) except select * from t4;
 | |
| c1	c2
 | |
| select * from t4 except ((select * from t4 where c1=1) except (select * from t4 where c1=2));
 | |
| c1	c2
 | |
| 2	0
 | |
| 3	1
 | |
| 4	1
 | |
| select * from t4 except ((select * from t4 where c1=1) union (select * from t4 where c1=2));
 | |
| c1	c2
 | |
| 3	1
 | |
| 4	1
 | |
| drop table if exists t5,t6;
 | |
| create table t5(c1 int primary key, c2 int);
 | |
| create table t6(c1 int primary key, c2 int);
 | |
| insert into t5 values(1,1),(2,2),(3,3),(4,4),(5,5),(6,2),(7,3),(8,6);
 | |
| insert into t6 values(0,0),(2,2),(4,4),(6,6);
 | |
| select c2 from t5 except select c2 from t6;
 | |
| c2
 | |
| 1
 | |
| 3
 | |
| 5
 | |
| select c2 from t5 except  all select c2 from t6;
 | |
| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'all select c2 from t6' at line 1
 | |
| drop table t1,t2,t3,t4,t5,t6;
 | 
