mysql数据库大量造数据

1、准备一条插入sql:

INSERT INTO `t_game_record`(`id`, `game_id`, `viewer_id`, `guess_price`, `status`, `create_date`, `update_date`) VALUES (396, 511, 28679, 1000.00, '0', '2019-07-01 15:36:26', '2019-07-01 15:36:26');

2、将上边的sql插入要造数据的那个表,即“t_game_record”表;

        注:如果该表中有数据,则不需要再次插入该sql。

3、准备批量造数据的sql:

insert into t_game_record(`game_id`, `viewer_id`, `guess_price`, `status`, `create_date`, `update_date`) select `game_id`, `viewer_id`, `guess_price`, `status`, `create_date`, `update_date` from t_game_record where game_id = 511 ;

执行该sql,多次执行该sql,数据按幂次增长;(即:1条执行一次边2条,再执行一次边4条,再再执行一次变8条…)

注:把表中的id去掉,插入的数据为id自增。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/bigge_L/article/details/108184211
今日推荐