create database test;
字段类型:
id : 编号
uname: 用户名
ucreatetime : 创建时间
age : 年龄
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 ,指插入多少条数据,可以修改。
call test1;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。