MYSQL 不写脚本,用 SQL 乱序 ID 主键
添加一个 r INT(10),复制一个同样结构的表
UPDATE table SET r=FLOOR(1 + (RAND() * 10800));
INSERT INTO table_copy
(xxx,xxx,xxx)
SELECT xxx,xxx,xxx FROM table
ORDER BY r DESC;
C'est La Vie
添加一个 r INT(10),复制一个同样结构的表
UPDATE table SET r=FLOOR(1 + (RAND() * 10800));
INSERT INTO table_copy
(xxx,xxx,xxx)
SELECT xxx,xxx,xxx FROM table
ORDER BY r DESC;