# mysql5.7通过函数遍历创建百万数据
# 创建存储过程
DELIMITER $$
CREATE PROCEDURE `func`(IN num INT)
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i<=num DO
INSERT INTO big_data_users(name,age,email) VALUES("张三",i,"1119880660.qq.com");
SET i = i+1;
END WHILE;
END$$
DELIMITER ;
# 调用存储过程
call fun(1000000);
转载:https://programmer-poem.dreams-road.site/myContent/detail?articleId=e387ddda-46ad-4e1a-8a37-cd475591bba7