How to do a batch insert in MySQL

后端 未结 5 1613
离开以前
离开以前 2020-11-22 10:29

I have 1-many number of records that need to be entered into a table. What is the best way to do this in a query? Should I just make a loop and insert one record per itera

5条回答
  •  抹茶落季
    2020-11-22 11:30

    Insert into table(col1,col2) select col1,col2 from table_2;
    

    Please refer to MySQL documentation on INSERT Statement

提交回复
热议问题