分析语句 函数 作用 定义 示例 ascii 第一个字符的ASCII 值 ascii(string T) > integer SELECT ascii('t') LIMIT 1 concatws 连接字符串 concatws(separator, string, string) > string SELECT concatws('', 'Tutorial', 'is', 'fun!') LIMIT 1 left 从左往右取字符串 left(string T, integer) > T SELECT left('hello', 2) LIMIT 1 length 长度 length(string) > integer SELECT length('hello') LIMIT 1 locate 查找字符串 locate(string, string) > integer SELECT locate('o', 'hello') LIMIT 1 replace 替换字符串 replace(string T, string, string) > T SELECT replace('hello', 'l', 'x') LIMIT 1 right 从右往左取字符串 right(string T, integer) > T SELECT right('hello', 1) LIMIT 1 rtrim 去除右侧空字符串 rtrim(string T) > T SELECT rtrim('hello ') LIMIT 1 substring 取子字符串 substring(string T, integer, integer) > T SELECT substring('hello', 2,5) LIMIT 1 trim 去除两侧空字符串 trim(string T) > T SELECT trim(' hello ') LIMIT 1 upper 全部转为大写 upper(string T) > T SELECT upper('helloworld') LIMIT 1
来自: