美文网首页
MySQL批量添加数据

MySQL批量添加数据

作者: 超音速6 | 来源:发表于2020-07-06 00:38 被阅读0次

    创建存储过程

    create procedure sum1(a int) 
    begin
      declare i int default 0; -- default 是指定该变量的默认值
      while i<a DO -- 循环开始
        insert into biz_tags(name,description,create_time,update_time) values(CONCAT('标签', i),NULL,now(),now());
        set i=i+1;
      end while; -- 循环结束
    end;
    

    执行存储过程

    call sum1(100);
    

    删除存储过程

    drop procedure if exists sum1;
    

    相关文章

      网友评论

          本文标题:MySQL批量添加数据

          本文链接:https://www.haomeiwen.com/subject/htriqktx.html