MySQL之字符串函数
1.MySQL之字符串函数
MySQL中内置了很多字符串函数,常用的几个如下:
2. concat
字符串拼接
select concat('Hello' , ' MySQL');
3.lower
全部转小写
select lower('Hello');
4.upper
全部转大写
select upper('Hello');
5. lpad
左填充
select lpad('01', 5, '-');
6.rpad
右填充
select rpad('01', 5, '-');
7.trim
去除空格
select trim(' Hello MySQL ');
8.substring
截取子字符串
select substring('Hello MySQL',1,5);
9.案例