mysql 备忘录

一、清空数据库中一张表的命令:
TRUNCATE TABLE '表名',这条命令比delete快很多,因为它实际上是删除了表,然后又重新新建了一张表。

二、查找字段重复的数据:
select * from product where pid in (select pid from product group by pid having count(pid) > 1)

三、如何批量修改某个字符串字段:
update product set ThumbUrl = concat("http://", ThumbUrl) where ThumbUrl like 'www%'; 这行语句是对以"www"开头的ThumbUrl字段的起始位置添加"http://"字符串

update product set Url = replace(ThumbUrl,'http://192.168.1.1:8080','http://baidu.com'), ImageUrl = replace(ImageUrl,'http://192.168.1.1:8080','http://baidu.com') where Url like 'http://192.168.1.1:8080%'; 这行语句是将Url字段中包含"http://192.168.1.1:8080"的字段中"http://192.168.1.1:8080"全部替换成"http://baidu.com"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值