经常需要测试数据,写个存储过程方便日后使用。
DROP PROCEDURE IF EXISTS add_member;
DELIMITER $$
CREATE PROCEDURE add_member (IN loop_times INT)
BEGIN
DECLARE member_account INT DEFAULT 0;
WHILE member_account < loop_times DO
SET member_account = member_account + 1;
INSERT INTO t_member ( member_name, member_password ) VALUES ( member_account, 'e10adc3949ba59abbe56e057f20f883e' );
END WHILE;
END $$ CALL add_member (10000000);