a) 先把下面的语句执行一遍,然后生成了一个test的函数(这个名字随你改)

注意:小明后面的那个i 是自动增长的,从小明1开始一直到小明10000,i可以用在其他列中,你自己调用。

begin

declare i int;

set i=1;

while i<=10000 do

INSERT INTO `org`.`sys_user` (`did`, `username`,`jobnumber`, `sex`, `email`, `phone`, `password`, `status`, `remark`) VALUES('1', concat('小明',i), '10017', '男', '[email protected]', '13569848512','123456', '1', NULL);

set i=i+1;

end while;

看图可能更加清楚关键字:

sql 批量插入数据 存储过程

b) 调用存储过程

CALL test(); 

c) 恭喜你插入了一万条数据

相关文章:

  • 2021-11-04
  • 2021-05-25
  • 2021-05-21
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-02-23
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案