标签:字母 bbb fga bsp 获取 截取 sql rom 学习
*单行函数
*length(获取字节个数)
select length("join") 返回4
*concat(拼接)
select concat("firstname","_","last_name"); firstname_last_name
*upper(将所有字母变大写)
select upper(zqc); ZQC
*lower(将所有字母变小写)
select lower(ZQC); zqc
*substr(截取字符)
select substr("abcdef",3) cdef
select substr("abcdef",2,3) bcd
*instr(返回子串第一次出现的开始索引,如果没有返回0)
select instr("abcdefg","cd") 3
select instr("abcdefg","cfd") 0
*trim(去掉前后的空格)
select trim(" abc "); abc
select trim("a" from "aaaaabbbbbaaaaaa") bbbbb
*lpad (左填充)
select lpad("abc",10,"a") aaaaaaaabc
select lpad("abc",2,"a") ab
*rpad(右填充)
select rpad ("abc",10,"a") abcaaaaaaa
select rpad("abc",2,"a") ab
*replace (代替)
select replace("abccdefg","abc","haha") hahacdefg
select replace("abcdefgabcabc","abc","ha") hadefghaha
标签:字母 bbb fga bsp 获取 截取 sql rom 学习
原文地址:https://www.cnblogs.com/Be-your-own-hero/p/11318160.html