Skip to content

Instantly share code, notes, and snippets.

@idandagan1
Created April 13, 2022 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idandagan1/e156a265e14e9cc5de6c2aa490782069 to your computer and use it in GitHub Desktop.
Save idandagan1/e156a265e14e9cc5de6c2aa490782069 to your computer and use it in GitHub Desktop.
Populate MySQL table with random data
DELIMITER $$
CREATE PROCEDURE insert_data()
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < 13000000 DO
INSERT INTO customer (session, customer_id, product_id) VALUES
(CONCAT(i+1, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+2, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+3, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+4, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+5, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+6, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+7, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+8, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+9, '-', '4949-a976-3b125797f641'), i, i),
(CONCAT(i+10, '-', '4949-a976-3b125797f641'), i, i);
SET i = i + 11;
END WHILE;
END$$
DELIMITER ;
CALL insert_data();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment