github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/operator/operator.test (about) 1 -- @suite 2 -- @setup 3 drop table if exists t1; 4 create table t1 (spID smallint,userID bigint,score int); 5 insert into t1 values (1,1,1); 6 insert into t1 values (2,2,2); 7 insert into t1 values (2,1,4); 8 insert into t1 values (3,3,3); 9 insert into t1 values (1,1,5); 10 insert into t1 values (4,6,10); 11 insert into t1 values (5,11,99); 12 create table t2(product VARCHAR(32),country_id INTEGER NOT NULL,year INTEGER,profit INTEGER); 13 insert into t2 values ( 'Computer', 2,2000, 1200), 14 ( 'TV', 1, 1999, 150), 15 ( 'Calculator', 1, 1999,50), 16 ( 'Computer', 1, 1999,1500), 17 ( 'Computer', 1, 2000,1500), 18 ( 'TV', 1, 2000, 150), 19 ( 'TV', 2, 2000, 100), 20 ( 'TV', 2, 2000, 100), 21 ( 'Calculator', 1, 2000,75), 22 ( 'Calculator', 2, 2000,75), 23 ( 'TV', 1, 1999, 100), 24 ( 'Computer', 1, 1999,1200), 25 ( 'Computer', 2, 2000,1500), 26 ( 'Calculator', 2, 2000,75), 27 ( 'Phone', 3, 2003,10); 28 29 -- @case 30 -- @desc:test for operators 31 -- @label:bvt 32 select userID,spID,score from t1 where userID=spID and userID<>score; 33 select userID,spID,score from t1 where userID=spID and userID!=score; 34 select userID,spID,score from t1 where userID between spID and score; 35 select userID,spID,score from t1 where userID not between spID and score; 36 select * from t1 where userID between 3 and 6; 37 select userID,spID,score from t1 where spID>=userID*score; 38 select userID,score,spID from t1 where userID<=score/spID; 39 select spID,userID,score from t1 where spID>(userID-1); 40 select spID,userID,score from t1 where score<(spID*userID+1); 41 select userID, AVG(score) from t1 WHERE spID=2 group by userID order by userID; 42 select product, SUM(profit) from t2 where year>1999 group by product order by product desc; 43 select product, SUM(profit),AVG(profit) from t2 where product!='TV' group by product order by product asc; 44 select product, SUM(profit),AVG(profit) from t2 where product<>'TV' group by product order by product asc; 45 select product, SUM(profit),AVG(profit) from t2 where product='Phone' group by product order by product asc; 46 select product, SUM(profit) from t2 where year>1999 and year<=2002 group by product order by product desc; 47 select * from t1 where 2<10; 48 select userID, userID DIV 2 as user_div, userID%2 as user_percent, userID MOD 2 as user_mod from t1 WHERE userID > 3; 49 select * from t1 where userID-2>2 && (userID+spID)/3<>0 && score MOD 2 > 0; 50 select * from t1 where spID >2 && userID < 6 && score != 1; 51 drop table if exists t2; 52 create table t2(c1 int, c2 int); 53 insert into t2 values (-3, 2); 54 insert into t2 values (1, 2); 55 select -c1 from t2; 56 select c1, c2 from t2 order by -c1 desc; 57 drop table if exists t3; 58 create table t3 (c1 varchar(80)); 59 insert into t3 values ("a"), 60 ("abc"), 61 ("abcd"), 62 ("hello"), 63 ("test"), 64 ("C:\Program Files(x86)"), 65 ("C:\\Program Files(x86)"); 66 select * from t3; 67 create database if not exists likedb; 68 create database if not exists dblike; 69 show databases like 'like%'; 70 show databases like "%like%"; 71 show databases like "%aa%"; 72 drop database likedb; 73 drop database dblike; 74 SELECT * FROM t1 where t1.userID<6 OR NOT t1.userID; 75 SELECT * FROM t1 where NOT t1.userID OR t1.userID<6; 76 SELECT * FROM t1 where NOT t1.userID || t1.userID<6; 77 drop table if exists t1; 78 create table t1 (a int); 79 insert into t1 values (0),(1),(NULL); 80 select * from t1; 81 select * from t1 where not a between 2 and 3; 82 drop table if exists t3; 83 CREATE TABLE t3( 84 cont_nr int(11) NOT NULL primary key, 85 ver_nr int(11) NOT NULL default 0, 86 aufnr int(11) NOT NULL default 0, 87 username varchar(50) NOT NULL default '' 88 ); 89 INSERT INTO t3 VALUES (3359356,405,3359356,'Mustermann Musterfrau'); 90 INSERT INTO t3 VALUES (3359357,468,3359357,'Mustermann Musterfrau'); 91 INSERT INTO t3 VALUES (3359359,468,3359359,'Mustermann musterfrau'); 92 INSERT INTO t3 VALUES (3359360,0,0,'Mustermann Masterfrau'); 93 INSERT INTO t3 VALUES (3359361,406,3359361,'Mastermann Masterfrau'); 94 INSERT INTO t3 VALUES (3359362,406,3359362,'Mustermann MusterFrau'); 95 select username from t3 where username like 'Ma%'; 96 select username from t3 where username like '%Frau'; 97 select username from t3 where username like '%Mast%'; 98 select username from t3 where username like '%a_t%'; 99 drop table if exists t2; 100 create table t2(a int,b varchar(5),c float, d date, e datetime); 101 insert into t2 values(1,'a',1.001,'2022-02-08','2022-02-08 12:00:00'); 102 insert into t2 values(2,'b',2.001,'2022-02-09','2022-02-09 12:00:00'); 103 insert into t2 values(1,'c',3.001,'2022-02-10','2022-02-10 12:00:00'); 104 insert into t2 values(4,'d',4.001,'2022-02-11','2022-02-11 12:00:00'); 105 select * from t2 where a in (2,4); 106 select * from t2 where a not in (2,4); 107 select * from t2 where c in (2.001,2.002); 108 select * from t2 where b not in ('e',"f"); 109 select sum(a),c from t2 where a in (1,2) and d in ('2022-02-10','2022-02-11') group by c order by c; 110 111 select * from t2 where d in ('20220208','2022-02-09'); 112 select * from t2 where e not in ('2022-02-09 12:00:00') and a in (4,5); 113 select sum(a) as suma,e from t2 where e not in ('2022-02-09 12:00:00') and a in (4,5) group by e order by suma; 114 -- @bvt:issue 115 select * from t2 where c in (2.001,3); 116 drop table if exists t1; 117 create table t1(a int, b int unsigned); 118 insert into t1 values (-1, 1), (-5, 5); 119 select 1 & 2; 120 select -1 & 2; 121 select null & 2; 122 select a & 2, b & 2 from t1; 123 select 1 | 2; 124 select -1 | 2; 125 select null | 2; 126 select a | 2, b | 2 from t1; 127 select 1 ^ 2; 128 select -1 ^ 2; 129 select null ^ 2; 130 select a ^ 2, b ^ 2 from t1; 131 select 1 << 2; 132 select -1 << 2; 133 select null << 2; 134 select a << 2, b << 2 from t1; 135 delete from t1; 136 insert into t1 values (-5, 1024); 137 select 1024 >> 2; 138 select -5 >> 2; 139 select null >> 2; 140 select a >> 2, b >> 2 from t1; 141 delete from t1; 142 insert into t1 values (-5, 5); 143 select ~5; 144 select ~-5; 145 select ~null; 146 select ~a, ~b from t1; 147 select 2 << -2; 148 select 2 >> -2; 149 drop table if exists t1; 150 create table t1 (a tinyint); 151 insert into t1 values (2); 152 select a << 20 from t1; 153 select !true;