github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_string_startsWith_endsWith.test (about) 1 #starsWith,endsWith函数在MySQL里没有,是模仿Clickhouse语义的函数,只能在MO里测试 2 3 #SELECT,data type 4 drop table if exists t1; 5 create table t1(a int,b varchar(100),c char(20)); 6 insert into t1 values 7 (1,'Ananya Majumdar', 'IX'), 8 (2,'Anushka Samanta', 'X'), 9 (3,'Aniket Sharma', 'XI'), 10 (4,'Anik Das', 'X'), 11 (5,'Riya Jain', 'IX'), 12 (6,'Tapan Samanta', 'X'); 13 select a,startswith(b,'An') from t1; 14 select a,b,c from t1 where startswith(b,'An')=1 and startswith(c,'I')=1; 15 drop table t1; 16 17 drop table if exists t1; 18 create table t1(a int,b varchar(100),c char(20)); 19 insert into t1 values 20 (1,'Ananya Majumdar', 'XI'), 21 (2,'Anushka Samanta', 'X'), 22 (3,'Aniket Sharma', 'XI'), 23 (4,'Anik Das', 'X'), 24 (5,'Riya Jain', 'IX'), 25 (6,'Tapan Samanta', 'XI'); 26 select a,endsWith(b,'a') from t1; 27 select a,b,c from t1 where endswith(b,'a')=1 and endswith(c,'I')=1; 28 drop table t1; 29 30 31 #NULL,data type 32 drop table if exists t1; 33 create table t1(a varchar(255),b char(255)); 34 insert into t1 values(NULL, NULL); 35 insert into t1 values('a',null); 36 insert into t1 values(null, 'b'); 37 select startswith(a,b) from t1; 38 drop table t1; 39 40 drop table if exists t1; 41 create table t1(a varchar(255),b char(255)); 42 insert into t1 values(NULL, NULL); 43 insert into t1 values('a',null); 44 insert into t1 values(null, 'b'); 45 select endsWith(a,b) from t1; 46 drop table t1; 47 48 select endsWith('a', 'a') from dual; 49 select endsWith('a', 'b') from dual; 50 select endsWith('aaaa', 'a') from dual; 51 select endsWith('xsdfsdf', 'fsdf') from dual; 52 select endsWith('xsdfsdf', 'fsdfx') from dual; 53 54