“改变大小写函数”:upper:上(大写);lower:下(小写)
"改变大小写函数":upper:上(大写);lower:下(小写)
select upper('aaaa');
select lower('AAAA');
“连接函数”:concat:连接
"连接函数":concat:连接
select concat('aaa','_','bbb');
select concat(upper('aaa'),'_',lower('BBB'));
“选择一段子串”:substr:子串–sub:附属品;string:字符串;substr:附属字符串
"选择一段子串":substr:子串
select substr('abcdefg',3);
select substr('abcdefg',3,2);
select substr('abcdefg',3,3);
“查询某个字符在什么位置”:instr–in:在xx内;string字符串;instr:在xx中的字符串
"查询某个字符在什么位置":instr
select instr('abcdefg','c');
select instr('abcdefg','de');
select instr('abcdefg','df');
select instr(substr('abcdefg',3),'f');
“查询字符的长度”:length:长度
"查询字符的长度":length:长度
select length('abcdefg');
select length('罗德abc');
“修剪-默认减掉前后的空格”:trim:修剪-用from连接修剪具体字符;字符要加’'或""
"修剪-默认减掉前后的空格":trim:修剪-用from连接修剪具体字符;字符要加''或""
select trim(' 123 ');
select trim('a' from 'aaaabbbbcccc');
select trim('a' from 'aaabbbaaa');
“替换”:replace:替换
"替换":replace:替换
select replace('abcdefg','a','6');
“补充字符”:lpad:左边-rpad:右边;left左边;right右边;pad填充–lpad:左边填充
"补充字符":lpad:左边-rpad:右边;left左边;right右边;pad填充
select lpad('aaa',10,'bbb');
select rpad('aaa',10,'b');
select rpad(lpad('a',2,'a'),4,'b');