美文网首页
mysql批量模拟数据

mysql批量模拟数据

作者: 老胡聊聊天 | 来源:发表于2017-10-19 09:30 被阅读154次

两种方式都可以,第一种慢点,第二种很快。

1、利用存过批量生成

DELIMITER ;; 
CREATE PROCEDURE test_insert()

BEGIN 
DECLARE a INT DEFAULT 1; 
WHILE (a <= 100) DO 
SET a = a + 1; 
insert into test (name) values (UUID());
END WHILE; 
commit; 
END;; 
CALL test_insert();

2、复制表数据:

insert into test (name) select name from test;

相关文章

网友评论

      本文标题:mysql批量模拟数据

      本文链接:https://www.haomeiwen.com/subject/avzyuxtx.html