MySQL Batch Add Data and Store Example

DELIMITER $$
-- If the procedure already exists, delete it
DROP PROCEDURE IF EXISTS SAVERANDDATA;
-- Create procedure name
CREATE PROCEDURE SAVERANDDATA()
BEGIN
	DECLARE i INT;
	SET i = 0;
	-- Defining the MYSQL REPEAT Statement
	REPEAT
		-- SQL content
		INSERT INTO `lzhstore`.`almart_all` (
			`date_key`,
			`hour_key`,
			`client_key`,
			`item_key`,
			`account`,
			`expense`
		)
		VALUES
		(
			"2016-05-01",
			FLOOR(RAND() * 24),
			FLOOR(RAND() * 1000000) + 1,
			FLOOR(RAND() * 100000) + 1,
			FLOOR(RAND() * 20) + 1,
			FLOOR(RAND() * 10000) + 1
		);	
	SET i = i + 1;
  -- Ends the loop if executed one million times
  UNTIL i = 1000000 END REPEAT;
	END $$
	CALL SAVERANDDATA();

Read More: