create database test;
字段類型:shell
id : 編號
uname: 用戶名
ucreatetime : 建立時間
age : 年齡ide
CREATE TABLE usertb( id serial, uname varchar(20) , ucreatetime datetime , age int(11)) ENGINE=innodb DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1 ROW_FORMAT=COMPACT;
delimiter $$ SET AUTOCOMMIT = 0$$ create procedure test1() begin declare v_cnt decimal (10) default 0 ; dd:loop insert into usertb values (null,'用戶1','2010-01-01 00:00:00',20), (null,'用戶2','2010-01-01 00:00:00',20), (null,'用戶3','2010-01-01 00:00:00',20), (null,'用戶4','2010-01-01 00:00:00',20), (null,'用戶5','2011-01-01 00:00:00',20), (null,'用戶6','2011-01-01 00:00:00',20), (null,'用戶7','2011-01-01 00:00:00',20), (null,'用戶8','2012-01-01 00:00:00',20), (null,'用戶9','2012-01-01 00:00:00',20), (null,'用戶0','2012-01-01 00:00:00',20) ; commit; set v_cnt = v_cnt+10 ; if v_cnt = 10000000 then leave dd; end if; end loop dd ; end;$$ delimiter ;
上面的v_cnt = 10000000 ,指插入多少條數據,能夠修改。oop
call test1;