当前位置: 移动技术网 > IT编程>数据库>Mysql > Mysql中 instr与concat

Mysql中 instr与concat

2019年11月12日  | 移动技术网IT编程  | 我要评论

#instr(字符串, 子串),
#返回值:第一个子串的索引-1
#类似indexof()
#例如:
select instr('人民万岁,世界万岁','万')
select instr('人民万岁,世界万岁','中华')

#instr(字段名, 字符串)
#例如
select *,instr(depart,'系') instr from teacher where instr(depart,'系')>0

#concat(str1,str2,...)
#类似:连接字符串
select concat(tno,'_',tname) tno_name , t.* from teacher t

select t.* from teacher t where t.prof like concat('%','教','%')

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网