如果想要不同数量只需要改变 while num < 3 这个3就可以了。
几百几千这个方法比较好使,都是如果你要添加几万什么的。时间耗死你。
此方法只是插入少量数据,制作练习数据库
#第一步:向表 中插入数据
delimiter $$
create procedure hanshuName () #函数名
begin
declare num int ;
set num = 1 ;
while num < 3 do #插入2条数据
insert into 表名 (user_id, item_id, category_id,behavior,ts) #表的字段
values
(concat("值", num),concat('值',num),concat('值',num),'link', "2020-07-16 10:21:18") ; #插入的表数值
set num = num + 1 ;
end
while ;
end$$
call hanshuName()$$
#注意:上面的内容全部选中一起运行
#第二步:查看插入的数据
select * from 表名;