mysql 常用技巧

时间:2014-06-07 06:05:12   收藏:0   阅读:280

1.正则使用 比 LIKE 会牺牲很多的系统资源 尽量不要用

  正则的语法和JS PHP 差不多

  select * from t1 where email REGEXP "@163[,.]com$";

  select * from t1 where email like "%@163.com" or email like "%@163,com"

2.REPLACE 函数的使用

  UPDATE `v9_zhushou` SET `thumb` = REPLACE(`thumb`, ‘http://localhost/ciwei/‘, ‘http://www.qciwei.com/ciwei/‘) WHERE `id` > 0

  UPDATE `v9_zhushou_data` SET `iphone` = REPLACE(`iphone`, ‘http://localhost/ciwei/‘, ‘http://www.qciwei.com/ciwei/‘) WHERE `id` = 300

  

  

mysql 常用技巧,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!