1.insert select from
INSERT INTO individuals_id (id, param, flag)
SELECT
id,
1 AS param,
0 AS flag
FROM
entities_copy
WHERE
LENGTH(id) > 0
2.不同表之间update
UPDATE entities a,
entities_industries b
SET a.industries = b.industries
WHERE
a.id = b.id
AND LENGTH(b.industries) > 0
4.提高性能的表写入操作
--锁表
LOCK TABLES `order` WRITE;
--禁用键
ALTER TABLE `order` DISABLE KEYS ;
--插入数据
INSERT INTO `order` VALUES (1,11,'UPDATED');
INSERT INTO `order` VALUES (2,11,'UPDATED');
--启用键
ALTER TABLE `order` ENABLE KEYS;
--解锁表
UNLOCK TABLES;