我有 1 多个需要输入到表中的记录。在查询中执行此操作的最佳方法是什么?我应该只做一个循环并在每次迭代中插入一条记录吗?还是有更好的办法?
最佳答案
来自 MySQL manual
INSERT statements that use VALUES syntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas. Example:
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
关于mysql - 如何在 MySQL 中进行批量插入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5526917/