๋กœ์ผ“๐Ÿพ
article thumbnail

 

๋”๋ฏธ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฝ์ž…ํ•˜๋Š” ํ”„๋กœ์‹œ์ € ์ƒ์„ฑ

ํŽ˜์ด์ง• ํ…Œ์ŠคํŠธ์™€ ๊ฐ™์ด ๋งŽ์€ ์–‘์˜ ๋”๋ฏธ๋ฐ์ดํ„ฐ(dummy data)๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ, ํ”„๋กœ์‹œ์ €๋ฅผ ์ƒ์„ฑํ•ด์„œ ๋”๋ฏธ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฝ์ž…ํ•  ์ˆ˜ ์žˆ๋‹ค. Workbench์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž…๋ ฅํ•œ๋‹ค.

 

DELIMITER $$
DROP PROCEDURE IF EXISTS loopInsert$$


CREATE PROCEDURE loopInsert()
BEGIN
    DECLARE i INT DEFAULT 1;
        
    WHILE i <= 500 DO
        INSERT INTO TBL_BOARD(title , content, writer , regDate , viewCnt)
          VALUES(concat('์ œ๋ชฉ',i), concat('๋‚ด์šฉ',i), 'Admin', now(), 0);
        SET i = i + 1;
    END WHILE;
END$$
DELIMITER $$

ํ”„๋กœ์‹œ์ € ์‹คํ–‰

CALL loopInsert;
profile on loading

Loading...