MySQL中update替换部分字符串replace的简单用法

  近日,遇到了需要将部分字符串替换为另外的字符,平时用的最多的是直接update整个字段值,在这种情况下效率比较低,而且容易出错。其实mysql提供了正则表达式中replace这个函数,用起来很简单,特此记录如下:

1、创建测试数据

DROP TABLE IF EXISTS  `activity`;
CREATE TABLE `activity` (
`id` bigint(20) NOT NULL,
`code` varchar(100) NOT NULL COMMENT '活动编号',
`name` varchar(64) NOT NULL COMMENT '活动名称',
`desc` varchar(64) DEFAULT NULL COMMENT '活动描述',
`type` tinyint(4) NOT NULL COMMENT '活动类型:事件活动,分享活动',
`count` int(11) NOT NULL COMMENT '可完成次数',
`auto_receive` int(11) DEFAULT '' COMMENT '是否自动领取奖励',
`show_in_center` int(11) DEFAULT '' COMMENT '是否在任务中心展示',
`reward_gold` int(11) NOT NULL COMMENT '奖励金币个数',
`reward_silver` int(11) NOT NULL COMMENT '奖励银币个数',
`time_unit` varchar(45) NOT NULL COMMENT '活动间隔时间单位',
`time` int(11) NOT NULL COMMENT '参加活动时间间隔',
`priority` int(11) NOT NULL COMMENT '活动优先级',
`event` varchar(100) DEFAULT NULL COMMENT '活动所需事件',
`show_after_activity` bigint(20) DEFAULT NULL COMMENT '在某个活动完成后出现',
`status` tinyint(4) NOT NULL COMMENT '活动是否有效',
`start_time` datetime(3) NOT NULL COMMENT '活动开始时间',
`end_time` datetime(3) NOT NULL COMMENT '活动结束时间',
`create_time` bigint(20) NOT NULL COMMENT '创建时间',
`update_time` bigint(20) NOT NULL COMMENT '更新时间',
`action` varchar(100) DEFAULT NULL COMMENT '活动所需的行动',
`action_details` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='活动表' ; insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(1,'addFriend','每日:添加好友','添加3位好友',1,3,0,1,100,0,'',0,999990,'addFriendEvent',null,0,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','ADDRESS_BOOK','{"button_desc":"立即添加"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(2,'friendTalk','和朋友聊天超过 25 句','与朋友聊天,可获得大量金币,聊的越多,赚的越多。与单个朋友聊天超过 25 句话,可获得额外金币!',1,25,1,1,25,0,'',0,130,'talkNtoN',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','TALK','{"button_desc":"去聊天"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(3,'addGroup','每日:加入群聊','加入群聊',1,1,0,1,15,0,'',0,999990,'addGroupEvent',null,0,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','ADD_FRIEND_OR_TEAM','{"button_desc":"立即加入"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(4,'groupTalk','群聊中发言超过 25 句','参与群聊,可获得大量金币,聊的越多,赚的越多。在单个群聊中发言超过 25 次,可获得额外金币!',1,25,1,1,25,0,'',0,140,'newGroupTalkEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','TALK','{"button_desc":"去聊天"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(5,'setUpID','设置聊天宝号','朋友可通过搜索“聊天宝号”找到你,快快抢注一个好记的聊天宝号吧!',1,1,1,1,50,0,'',0,60,'setIDEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','ACCOUNT_AND_SAFE','{"button_desc":"立即设置"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(6,'bindAlipay','绑定支付宝账号','绑定后可将现金收入提现到支付宝,也可通过支付宝扫码付款、发送聊天红包',1,1,1,1,100,0,'',0,40,'bindAlipayEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','ACCOUNT_AND_SAFE','{"button_desc":"去绑定"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(7,'inviteSuccess','新手:首次邀请好友注册','新手:首次邀请好友注册',1,1,0,1,300,0,'',0,999990,'inviteEvent',null,0,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','REDIRECT','{"button_desc":"去邀请","url":"https://point.zidanduanxin.com/invite"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(8,'shareIncome','晒收益','晒收益',2,1,0,0,100,0,'',0,100000,'',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','SHARE','{"income":"%d","button_desc":""}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(9,'scanAlipay','扫码支付','在右上角的菜单里使用扫码支付,线下付款成功后可获得金币奖励哦',2,1,0,1,50,0,'',0,91,'',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','SCAN_ALIPAY','{"button_desc":""}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(10,'treasureBox','完成任务','宝箱任务',1,2,0,0,18,0,'',0,100000,'activityCompleteEvent',-1,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','','{"button_desc":"","condition_desc":"还需要完成%s个任务打开宝箱"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(11,'treasureBox','完成任务','宝箱任务',1,4,0,0,68,0,'',0,100000,'activityCompleteEvent',-1,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','','{"button_desc":"","condition_desc":"还需要完成%s个任务打开宝箱"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(12,'treasureBox','完成任务','宝箱任务',1,6,0,0,88,0,'',0,100000,'activityCompleteEvent',-1,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','','{"button_desc":"","condition_desc":"还需要完成%s个任务打开宝箱"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(13,'treasureBox','完成任务','宝箱任务',1,8,0,0,48,0,'',0,100000,'activityCompleteEvent',-1,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','','{"button_desc":"","condition_desc":"还需要完成%s个任务打开宝箱"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(14,'firstTextMoments','发 1 条文字熟人圈帖子','发送一条纯文字形式的熟人圈帖子可获得金币奖励',3,1,1,1,20,0,'',0,150,'postTextMomentsEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS_TEXT','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(15,'firstImageMoments','发 1 条图文熟人圈帖子','发送一条包含图片的熟人圈帖子可获得金币奖励',3,1,1,1,20,0,'',0,160,'postImageMomentsEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS_TEXT','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(16,'firstVideoMoments','发 1 条视频熟人圈帖子','发送一条包含视频的熟人圈帖子可获得金币奖励',3,1,1,1,20,0,'',0,170,'postVideoMomentsEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS_TEXT','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(17,'likeFriendsMoments','给 3 个熟人圈帖子点赞','给 3 个好友的熟人圈帖子各点赞 1 次即可获得金币奖励,点赞自己发的帖子不算哦',3,3,1,1,10,0,'',0,999990,'likeFriendsMomentsEvent',null,0,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(18,'commentFriendsMoments','给 3 个朋友评论','给 3 个朋友的熟人圈帖子各评论 1 次即可获得金币奖励,评论自己发的帖子不算哦',3,3,1,1,15,0,'',0,180,'commentFriendsMomentsEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(19,'momentsBeLiked','被 5 个朋友点赞','自己发的熟人圈帖子,被 5 个以上的好友点赞,即可获得金币奖励',1,5,0,1,30,0,'',0,999990,'momentsBeLikedEvent',null,0,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(20,'momentsBeCommented','被 5 个朋友评论','自己发的熟人圈帖子,被 5 个以上的朋友评论,即可获得金币奖励,回复朋友评论还可能获得额外奖励',1,5,1,1,30,0,'',0,120,'momentsBeCommentedEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(21,'inviteSmsFriend','邀请 1 个通讯录朋友','首次通过通讯录邀请朋友注册聊天宝,不仅能够获得邀请红包,更能获得 150 金币哦',1,1,1,1,150,0,'',0,0,'smsInviteEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','REDIRECT','{"button_desc":"去邀请","url":"https://point.zidanduanxin.com/invite"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(22,'inviteQQFriend','邀请 1 个 QQ 朋友','首次通过 QQ 邀请朋友注册聊天宝,不仅能够获得邀请红包,更能获得 100 金币哦',1,1,1,1,100,0,'',0,10,'qqInviteEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','REDIRECT','{"button_desc":"去邀请","url":"https://point.zidanduanxin.com/invite"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(23,'inviteWechatFriend','邀请 1 个微信朋友','首次通过微信邀请朋友注册聊天宝,不仅能够获得随机邀请红包,更能获得 100 金币哦',1,1,1,1,100,0,'',0,20,'wechatInviteEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','REDIRECT','{"button_desc":"去邀请","url":"https://point.zidanduanxin.com/invite"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(24,'setReadName','昵称修改为真实姓名','将昵称设置为真实姓名更容易朋友认出来哦,快去完成任务领取金币吧',1,1,1,1,100,0,'',0,30,'setNameEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','PERSONAL_INFO','{"button_desc":"去修改"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(25,'setRealAvatar','设置真人头像','设置真人头像更容易被朋友认出来哦,快去完成任务领取金币吧',1,1,1,1,50,0,'',0,50,'setAvatarEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','PERSONAL_INFO','{"button_desc":"去设置"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(26,'setProfileInfo','完善个人信息','完善你的性别、地区、签名,能让你的朋友更加了解你哦!全部填完才能领取奖励',1,1,1,1,50,0,'',0,70,'setInfoEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','PERSONAL_INFO','{"button_desc":"立即设置"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(27,'firstRead','首次阅读 1 篇新闻','在新闻页面选择 1 篇感兴趣的新闻并获得 1 次阅读奖励,即可额外获得 50 金币奖励',1,1,1,1,50,0,'',0,80,'firstReadEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','NEWS','{"button_desc":"去阅读"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(28,'firstMoments','发送 1 条熟人圈帖子','发送 1 条熟人圈帖子即可获得额外金币,文字、图片、小视频都可以',1,1,1,1,50,0,'',0,90,'firstMomentsEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','MOMENTS_TEXT','{"button_desc":"去完成"}');
insert into `activity`(`id`,`code`,`name`,`desc`,`type`,`count`,`auto_receive`,`show_in_center`,`reward_gold`,`reward_silver`,`time_unit`,`time`,`priority`,`event`,`show_after_activity`,`status`,`start_time`,`end_time`,`create_time`,`update_time`,`action`,`action_details`)
values(29,'dailyRead','阅读新闻 20 分钟','每天阅读新闻 20 分钟,除了阅读过程中的奖励,还可获得额外金币奖励!',1,1200,1,1,30,0,'',0,100,'readEvent',null,1,'2018-11-17 11:29:21','2022-11-17 11:29:22','','','NEWS','{"button_desc":"去完成"}');

2、查询name、desc中含有好友的记录

mysql> select id,name,`desc`,update_time from activity where name regexp '好友' or desc regexp '好友';
+------+-----------------------------------+--------------------------------------------------------------------------------------------------------------+---------------+
| id | name | desc | update_time |
+------+-----------------------------------+--------------------------------------------------------------------------------------------------------------+---------------+
| 1 | 每日:添加好友 | 添加3位好友 | 1542454142000 |
| 7 | 新手:首次邀请好友注册 | 新手:首次邀请好友注册 | 1543327524000 |
| 17 | 给 3 个熟人圈帖子点赞 | 给 3 个好友的熟人圈帖子各点赞 1 次即可获得金币奖励,点赞自己发的帖子不算哦 | 1543327524000 |
| 19 | 被 5 个朋友点赞 | 自己发的熟人圈帖子,被 5 个以上的好友点赞,即可获得金币奖励 | 1543327524000 |
+------+-----------------------------------+--------------------------------------------------------------------------------------------------------------+---------------+
4 rows in set (0.01 sec)

3、用update 含有 replace函数进行修改

-- 将name和desc中的好友字符串替换成朋友
mysql> update activity set name=replace(name,'好友','朋友'), `desc`=replace(`desc`,'好友','朋友') where name regexp '好友' or desc regexp '好友';
Query OK, 4 rows affected (0.03 sec)

4、再次查询结果验证

mysql> select id,name,`desc`,update_time from activity where name regexp '好友' or desc regexp '好友';
Empty set (0.01 sec)
mysql> select id,name,`desc`,update_time from activity where id in (1,7,17,19);
+------+-----------------------------------+--------------------------------------------------------------------------------------------------------------+---------------+
| id | name | desc | update_time |
+------+-----------------------------------+--------------------------------------------------------------------------------------------------------------+---------------+
| 1 | 每日:添加朋友 | 添加3位朋友 | 1542454142000 |
| 7 | 新手:首次邀请朋友注册 | 新手:首次邀请朋友注册 | 1543327524000 |
| 17 | 给 3 个熟人圈帖子点赞 | 给 3 个朋友的熟人圈帖子各点赞 1 次即可获得金币奖励,点赞自己发的帖子不算哦 | 1543327524000 |
| 19 | 被 5 个朋友点赞 | 自己发的熟人圈帖子,被 5 个以上的朋友点赞,即可获得金币奖励 | 1543327524000 |
+------+-----------------------------------+--------------------------------------------------------------------------------------------------------------+---------------+
4 rows in set (0.01 sec)

mysql中replace替换字符串更改方法的更多相关文章

  1. 在SQL SERVER中批量替换字符串的方法

    UPDATE MainData SET Content = )) , 'XM00000137' , 'XM00000078') WHERE [Key] IN (SELECT md_key FROM i ...

  2. SQL 中 replace 替换字符串中的字符 ''

    update CfmRcd set reconsource=replace(reconsource,'''',''), cmffile =replace(cmffile,'''',''), cfmda ...

  3. (数据科学学习手札131)pandas中的常用字符串处理方法总结

    本文示例代码及文件已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 在日常开展数据分析的过程中,我们经常需要对 ...

  4. Mysql中replace与replace into的用法讲解

    Mysql replace与replace into都是经常会用到的功能:replace其实是做了一次update操作,而不是先delete再insert:而replace into其实与insert ...

  5. mysql中 REPLACE INTO 和 INSERT INTO 的区别

    mysql中 REPLACE INTO 和 INSERT INTO 的区别 REPLACE INTO 和 INSERT INTO 功能类似,都是像表中插入数据,不同点在于:REPLACE INTO 首 ...

  6. MYSQL中日期与字符串间的相互转换

    一.字符串转日期 下面将讲述如何在MYSQL中把一个字符串转换成日期: 背景:rq字段信息为:20100901 1.无需转换的: SELECT * FROM tairlist_day WHERE rq ...

  7. 【HANA系列】SAP HANA SQL REPLACE替换字符串

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[HANA系列]SAP HANA SQL REP ...

  8. [翻译]python3中新的字符串格式化方法-----f-string

    从python3.6开始,引入了新的字符串格式化方式,f-字符串. 这使得格式化字符串变得可读性更高,更简洁,更不容易出现错误而且速度也更快. 在本文后面,会详细介绍f-字符串的用法. 在此之前,让我 ...

  9. js replace替换字符串,同时替换多个方法

    在实际开发中,经常会遇到替换字符串的情况,但是大多数情况都是用replace替换一种字符串,本文介绍了如何使用replace替换多种指定的字符串,同时支持可拓展增加字符串关键字. let conten ...

随机推荐

  1. Linux shell编写脚本部署pxe网络装机

    Linux shell编写脚本部署pxe网络装机 人工安装配置,Linux PXE无人值守网络装机  https://www.cnblogs.com/yuzly/p/10582254.html 脚本实 ...

  2. Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler Optimization(二)

    接着上篇Asm2Vec神经网络模型流程继续,接下来探讨具体过程和细节. 一.为汇编函数建模  二.训练,评估   先来看第一部分为汇编函数建模,这个过程是将存储库中的每一个汇编函数建模为多个序列.由于 ...

  3. OKR源自德鲁克和格鲁夫,跟谷歌是天作之合:4星|《这就是OKR》

    这就是OKR,[美]约翰杜尔(John Doerr),中信出版社,9787508696881 作者以实习生的身份加入英特尔,跟格鲁夫有交集,见证了格鲁夫在英特尔创立OKR的过程和英特尔使用OKR作为管 ...

  4. C语言----int (*p)[4] ---思考总结

    a+1  跳4个int (*a)+1 跳一个int

  5. Spark中的一些概念

    最近工作用到Spark,这里记一些自己接触到的Spark基本概念和知识. 本文链接:https://www.cnblogs.com/hhelibeb/p/10288915.html 名词 RDD:在高 ...

  6. DB2批量插入性能对比

    import ibm_db import random import time first_names = '赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏' \ '陶姜戚谢邹喻柏水窦章 ...

  7. Linux 进入 5.0 时代!

    Linux 进入 5.0 时代! 为什么 Linux 4.2 之后的版本不再是 4.21 而是 5.0? 如果你非要一个理由,那就是因为 Linux 4.x 的版本如今用手指与脚趾加在一起都要数不过来 ...

  8. Spring Security(三十六):12. Spring MVC Test Integration

    Spring Security provides comprehensive integration with Spring MVC Test Spring Security提供与Spring MVC ...

  9. leetcode 224. Basic Calculator 、227. Basic Calculator II

    这种题都要设置一个符号位的变量 224. Basic Calculator 设置数值和符号两个变量,遇到左括号将数值和符号加进栈中 class Solution { public: int calcu ...

  10. Linux和Uboot下eMMC boot分区读写

    关键词:eMMC boot.PARTITION_CONFIG.force_ro等. 1. eMMC的分区 大部分eMMC都有类似如下的分区,其中BOOT.RPMB和UDA一般是默认存在的,gpp分区需 ...