SQL 拼接、替换、判断字符串包含

Sql的字符串相加:

Update sight s set s.address=concat(s.province,s.city);

 

Sql的字符串相减:

替换。将photo地址的jiangsu 替换为zhejiang

Update sight s set s.photo=replace(s.photo,’jiangsu’,’zhejiang’);

 

Sql 判断字段是否在某字符串中:

如:判断name是否在字符串'adfkadsfshtr'中

select * from User

where instr('adfkadsfshtr.', name)>0

猜你喜欢

转载自chenjinbo1983.iteye.com/blog/1894205