使用locate(substr,str)函数,如果包含,返回>0的数,否则返回0 


例子:判断site表中的url是否包含'http://'子串,如果不包含则拼接在url字符串开头

update site set url =concat('http://',url) where locate('http://',url)=0 


注意mysql中字符串的拼接不能使用加号+,用concat函数