MySQL数据库 : 高级查询与笔记
根据某个字段删除重复的数据, 只保留一条:
比如uuid字段有重复的, 需要只保留一条数据, 让uuid字段不能重复,
则首先 group by uuid 查出所有数据的id最小的那条数据,作为dt表的minid字段,
然后删除 id NOT IN 这些数据的所有数据(即为uuid重复的所有数据)
(参考: https://blog.csdn.net/n950814abc/article/details/82284838 )
DELETE FROM article WHERE id NOT IN ( SELECT dt.minid FROM ( SELECT MIN(id) AS minid FROM article GROUP BY uuid ) dt )
修改表的字符集和所有列的字符集:
ALTER TABLE xxxxx_table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
参考资料: https://www.inbeijing.org/archives/1466
oracle数据库导出导入数据文件命令
exp 'SC_CORE_xxxx/"Xxxx@2xxx_xxx"' compress=N buffer=65536 full=y file=/home/oracle/111.dmp
imp 'SC_CORE_xxxx/"xxxx@xxxx"' file=/home/oracle/111.dmp fromuser=SC_CORE_xxxxx touser=SC_CORE_yyyyy;
(updating ... ...)