oracle
从第3个字符开始,截取6个字符
select substr('Hello SQL!', 3, 6) from dual -----llo SQ
查找子串在源串中的位置,从第5位开始,第二次出现
select instr('city_company_staff', '_', 5,2) from dual -------13
字符串连接,oracle的concat()函数只支持两个参数,不支持两个以上字符串的拼接,可以使用多个concat()函数嵌套使用
select 'hello'|| 'world' || '你好' from dual -----helloworld你好
select concat('hello', 'world' ) from dual -----helloworld
字符串长度,lengthb返回字符串的长度,单位是字节
select length('hello world你好') from dual ----13
select lengthb('hello world你好') from dual ----17
mysql:
从左边截取length
select left('city_company_staff',2) ----ci
从右边截取length
select right('city_company_staff',2) -----ff
</