github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_string_char_length.result (about) 1 SELECT CHAR_LENGTH("你好"); 2 CHAR_LENGTH("你好") 3 2 4 SELECT CHAR_LENGTH("français"); 5 CHAR_LENGTH("français") 6 8 7 SELECT CHAR_LENGTH("にほんご"); 8 CHAR_LENGTH("にほんご") 9 4 10 SELECT CHAR_LENGTH("Español"); 11 CHAR_LENGTH("Español") 12 7 13 SELECT CHAR_LENGTH(NULL); 14 CHAR_LENGTH(NULL) 15 null 16 create table t1 (a char(20)); 17 insert into t1 values ('123456'),('андрей'); 18 select char_length(a), length(a), a from t1 order by a; 19 char_length(a) length(a) a 20 6 6 123456 21 6 12 андрей 22 drop table t1; 23 select char_length('\n\t\r\b\0\_\%\\'); 24 char_length(\n\t\r\b\0\_\%\\) 25 10 26 SELECT CHAR_LENGTH(concat_ws(" ",121,83,81,'76')) as my_column; 27 my_column 28 12 29 create table t (c varchar(20)); 30 insert into t values ('\\'); 31 select char_length(c) from t; 32 char_length(c) 33 1 34 insert into t values ('0C'); 35 select sum(char_length(c)) from t; 36 sum(char_length(c)) 37 3 38 insert into t values ('"'); 39 select sum(char_length(c)) from t; 40 sum(char_length(c)) 41 4 42 insert into t values ('\a'); 43 select sum(char_length(c)) from t; 44 sum(char_length(c)) 45 5 46 insert into t values ('\b'); 47 select sum(char_length(c)) from t; 48 sum(char_length(c)) 49 6 50 insert into t values ('\t'); 51 select sum(char_length(c)) from t; 52 sum(char_length(c)) 53 7 54 insert into t values ('\n'); 55 select sum(char_length(c)) from t; 56 sum(char_length(c)) 57 8 58 insert into t values ('\r'); 59 select sum(char_length(c)) from t; 60 sum(char_length(c)) 61 9 62 insert into t values ('10'); 63 select sum(char_length(c)) from t; 64 sum(char_length(c)) 65 11 66 drop table t; 67 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)); 68 insert into t1 values(1, 1, 2, 43, 5, 35.5, 31.133, 14.314, "2012-03-10", "2012-03-12 10:03:12", "2022-03-12 13:03:12", "ab23c", "d5cf"); 69 insert into t1 values(71, 1, 2, 34, 5, 5.5, 341.13, 15.314, "2012-03-22", "2013-03-12 10:03:12", "2032-03-12 13:04:12", "abr23c", "3dcf"); 70 insert into t1 values(1, 1, 21, 4, 54, 53.5, 431.13, 14.394, "2011-03-12", "2015-03-12 10:03:12", "2002-03-12 13:03:12", "afbc", "dct5f"); 71 insert into t1 values(1, 71, 2, 34, 5, 5.5, 31.313, 124.314, "2012-01-12", "2019-03-12 10:03:12", "2013-03-12 13:03:12", "3abd1c", "dcvf"); 72 select char_length(a),char_length(b),char_length(c),char_length(d),char_length(e),char_length(f),char_length(g),char_length(h),char_length(i),char_length(k),char_length(l),char_length(m),char_length(n) from t1; 73 char_length(a) char_length(b) char_length(c) char_length(d) char_length(e) char_length(f) char_length(g) char_length(h) char_length(i) char_length(k) char_length(l) char_length(m) char_length(n) 74 1 1 1 2 1 4 6 22 10 19 19 5 4 75 2 1 1 2 1 3 6 22 10 19 19 6 4 76 1 1 2 1 2 4 6 22 10 19 19 4 5 77 1 2 1 2 1 3 6 23 10 19 19 6 4 78 drop table t1; 79 create table t1(a int, b varchar(255)); 80 insert into t1 select char_length("你好"), "你好"; 81 insert into t1 select char_length("再见"), "再见"; 82 select distinct a, char_length(b) from t1; 83 a char_length(b) 84 2 2 85 drop table t1; 86 drop table if exists t1; 87 create table t1(a INT, b varchar(255)); 88 insert into t1 select char_length("你好"), "你好"; 89 insert into t1 select char_length("再见"), "再见"; 90 select * from t1 where char_length(b)=2; 91 a b 92 2 你好 93 2 再见 94 drop table t1; 95 drop table if exists t1; 96 drop table if exists t2; 97 create table t1(a INT, b varchar(255)); 98 create table t2(a INT, b varchar(255)); 99 insert into t1 select char_length("你好"), "你好"; 100 insert into t1 select char_length("再见"), "再见"; 101 insert into t2 select char_length("今天"), "日期时间"; 102 insert into t2 select char_length("明天"), "明天"; 103 SELECT t1.a, t2.a FROM t1 JOIN t2 ON (char_length(t1.b) = char_length(t2.b)); 104 a a 105 2 2 106 2 2 107 drop table t1; 108 drop table t2; 109 drop table if exists t1; 110 create table t1(a INT, b varchar(255)); 111 insert into t1 select char_length("你好"), "你好"; 112 insert into t1 select char_length("再见"), "再见"; 113 select b from t1 group by b having char_length(b)<3; 114 b 115 你好 116 再见 117 drop table t1; 118 SELECT char_length("你好")+char_length("再见"); 119 char_length("你好")+char_length("再见") 120 4