MySQL学习----MySQL函数(一)----10MySQL字符串函数
来源:互联网 发布:云计算 云服务 编辑:程序博客网 时间:2024/06/10 03:40
-- MySQL字符串函数
-- 字符串长度
select length("hello");
-- 变成小写
select lcase("Hello");
select lower("Hello");
-- -- 变成大写
select ucase("Hello");
select upper("Hello");
-- 字符串比大小(比的是首字母在字母表中的顺序)
select strcmp('hello','yes');
select strcmp('zello','yes');
select strcmp('yes','yes');
-- 字符串定位函数
select position('yes' in 'yesllo');
-- y替换成h
select replace('yes','y','h');
-- 插入函数
select insert ('yes wrold',2,3,'kkk');
-- 字符串合并
select concat('hello','world');
-- 字符串合并,加间隔符
select concat_ws(';','hello','world');
-- 取左边字符
select left('helloworld',3);
-- 取右边字符
select right('helloworld',3);
-- 左边填充
select lpad('helloworld', 15, 'x');
-- 右边填充
select rpad('helloworld', 15, 'x');
-- 去左空格函数
select ltrim(' helloworld');
-- 去左右空格函数
select trim(' helloworld ');
-- 截取字符串
select substring('macket',2,3);
-- -- 截取字符的ASCII
select ascii('a');
-- 字符串长度
select length("hello");
-- 变成小写
select lcase("Hello");
select lower("Hello");
-- -- 变成大写
select ucase("Hello");
select upper("Hello");
-- 字符串比大小(比的是首字母在字母表中的顺序)
select strcmp('hello','yes');
select strcmp('zello','yes');
select strcmp('yes','yes');
-- 字符串定位函数
select position('yes' in 'yesllo');
-- y替换成h
select replace('yes','y','h');
-- 插入函数
select insert ('yes wrold',2,3,'kkk');
-- 字符串合并
select concat('hello','world');
-- 字符串合并,加间隔符
select concat_ws(';','hello','world');
-- 取左边字符
select left('helloworld',3);
-- 取右边字符
select right('helloworld',3);
-- 左边填充
select lpad('helloworld', 15, 'x');
-- 右边填充
select rpad('helloworld', 15, 'x');
-- 去左空格函数
select ltrim(' helloworld');
-- 去左右空格函数
select trim(' helloworld ');
-- 截取字符串
select substring('macket',2,3);
-- -- 截取字符的ASCII
select ascii('a');
0 0
- MySQL学习----MySQL函数(一)----10MySQL字符串函数
- mysql字符串函数学习笔记
- MySQL常用函数(一):字符串函数
- MySql函数学习(一)
- MySQL函数学习笔记一:数学函数
- mysql的字符串函数
- mysql的字符串函数
- mysql的字符串函数
- mysql字符串函数
- mysql的字符串函数
- Mysql字符串函数收集
- MySql 字符串函数
- mysql的字符串函数
- MySql 的字符串函数
- mysql的字符串函数
- mysql的字符串函数
- MySQL字符串函数大全
- MySQL 字符串函数大全
- mybatis中jsp获取不同表字段显示
- JavaScript显式类型转换与隐式类型转换
- HashMap详解
- C++动态定义二维数组
- MySQL学习----MySQL函数(一)----09MySQL数学函数和聚合函数
- MySQL学习----MySQL函数(一)----10MySQL字符串函数
- MySQL学习----MySQL函数(一)----11MySQL日期和时间函数
- 数据结构实践——顺序表应用
- UVA12545 Bits Equalizer(脑洞)
- 如何查看Undo和Temp表空间中的会话
- 关于eclipse(64位)下aptana插件安装报错问题解决
- MapReduce的容错机制
- leetcode 70 Climbing Stairs(难易度:Easy)
- 9月风怒(2)