github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_string_bin.test (about) 1 #SELECT, 科学计数 2 select bin(0b11111111); 3 select bin(12); 4 SELECT bin(1314); 5 select bin(2e5); 6 7 #NULL 8 SELECT bin(null); 9 10 #嵌套 11 SELECT concat_ws(",", bin(1000), bin(2000)); 12 #EXTREME VALUES 13 select bin(0); 14 select bin(-1); 15 select bin(10e50); 16 select bin(-10e50); 17 select bin(0.00000000000000000000000001); 18 select bin(-0.00000000000000000000000001); 19 select bin("你好"); 20 create table t1(a int); 21 insert into t1 values(); 22 select bin(a) from t1; 23 drop table t1; 24 #create table t1(a tinyint, b SMALLINT, c BIGINT, d INT, e BIGINT, f FLOAT, g DOUBLE, h decimal(38,19), i DATE, k datetime, l TIMESTAMP, m char(255), n varchar(255)); 25 #insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf"); 26 #insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf"); 27 #insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf"); 28 #insert into t1 values(1, 1, 2, 4, 5, 5.5, 31.13, 14.314, "2012-03-12", "2012-03-12 10:03:12", "2012-03-12 13:03:12", "abc", "dcf"); 29 #select bin(a),bin(b),bin(c),bin(d),bin(e),bin(f),bin(g),bin(h),bin(i),bin(k),bin(l),bin(m),bin(n) from t1; 30 #drop table t1; 31 #create table t1(a time); 32 #insert into t1 values("10:03:12"); 33 #select bin(a) from t1; 34 #drop table t1; 35 CREATE TABLE t1(a char(255), b varchar(255)); 36 INSERT INTO t1 select bin(56), bin(234); 37 INSERT INTO t1 select bin(100), bin(234); 38 SELECT distinct bin(a), bin(b) FROM t1 ORDER BY bin(a); 39 drop table t1; 40 CREATE TABLE t1 (a int); 41 INSERT INTO t1 VALUES (100), (12); 42 SELECT a FROM t1 43 GROUP BY a 44 HAVING bin(a) <>0; 45 DROP TABLE t1; 46 drop table if exists t1; 47 CREATE TABLE t1 (a int); 48 CREATE TABLE t2 (a int); 49 INSERT INTO t1 VALUES (100), (200), (300), (10); 50 INSERT INTO t2 VALUES (100), (50), (20), (10), (300); 51 SELECT t1.a, t2.a FROM t1 JOIN t2 ON (bin(t1.a) = bin(t2.a)); 52 drop table t1; 53 drop table t2;