mysql插入大量数据

创建实验表:

CREATE TABLE `a` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(50)  NOT NULL,
`type` char(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;

 

创建存储语句:

delimiter //

create procedure insertdata() begin declare i int default 1; while i<10000 do insert into a (name,type) values(i,'true'); set i=i+1; end while; commit; end//

delimiter ;

 

调用:

call insertdata();

posted @ 2016-05-03 18:10  企鹅蛋  阅读(239)  评论(0编辑  收藏  举报