CREATE TABLE ' T_user ' (
' ID ' bigint (a) not NULL auto_increment,
' Name ' varchar (255) DEFAULT NULL,
' Age ' tinyint (4) DEFAULT NULL,
' Create_time ' datetime DEFAULT NULL,
' Update_time ' datetime DEFAULT NULL,
PRIMARY KEY (' id ')
) Engine=innodb DEFAULT Charset=utf8;
DELIMITER $$ By default DELIMITER is a semicolon and now defines the Terminator as $$.
Drop PROCEDURE if EXISTS {PROCEDURE} before deleting to determine whether the specified table or stored procedure exists
Create PROCEDURE creating a stored procedure
Begin
DECLARE Pre_name BIGINT; Define Prename as bigint type
DECLARE Ageval INT;
DECLARE i INT;
SET pre_name=187635267;
SET ageval=100;
SET I=1;
While I < 1000000 do
INSERT into T_user (' name ', Age,create_time,update_time) VALUES (CONCAT (Pre_name, ' @qq. com '), (ageval+1)%30,now (), Now ( ));
SET pre_name=pre_name+100;
SET i=i+1;
END while;
END $$
delimiter;
Call Proc_batch_insert (); Invoke a defined function
MySQL statements generate large amounts of test data in batches