-- CHARSET(str) 返回字符集
SELECT CHARSET(ename) FROM emp;
SELECT CONCAT(ename, ' 工作是 ', job) AS sumname FROM emp;
-- 查找子串位置,从1开始
SELECT INSTR('hanshunping', 'ping') AS pos FROM DUAL;
-- 转换大小写
SELECT UCASE(ename) FROM emp;
SELECT LCASE(ename) FROM emp;
-- 从左/右 取指定数量的字符
SELECT LEFT(ename, 2) FROM emp;
SELECT RIGHT(ename, 2) FROM emp;
-- 返回字符串长度
SELECT LENGTH(ename) FROM emp;
-- 字符串替换
SELECT REPLACE(job, 'MANAGER', '经理') FROM emp;
-- 从ename列的第一个位置取两个字符
SELECT SUBSTR(ename, 1, 2) FROM emp;
-- 左去空格(右边同理, 两边TRIM)
SELECT LTRIM(' 你好') FROM DUAL;
-- 以首字母小写显示所有员工emp表的名字
SELECT CONCAT(LCASE(SUBSTR(ename, 1, 1)), SUBSTR(ename, 2)) as new_name
FROM emp;
标签:ename,函数,--,SUBSTR,emp,字符串,SELECT
From: https://www.cnblogs.com/pureayu/p/17118256.html