Mysql批量插入数据


#创建存储过程
CREATE PROCEDURE test_insert()
    #开始
    BEGIN
        #定义变量 
        DECLARE i INT DEFAULT 40;
            #条件判断
            WHILE i<=170 
            #执行
            DO 
                #SQL
                insert into robot(name) values(CONCAT('step',i));
                #变量增加
                SET i=i+1;
            #结束循环 
            END WHILE ;
        #提交 
        commit; 
    #结束
    END;
#执行
CALL test_insert();
#删除存储过程
drop procedure test_insert;

posted @ 2021-05-03 17:51  爱时尚疯了的朱  阅读(143)  评论(0编辑  收藏  举报