在mysql中插入多行
如果我一次插入多行,数据库查询是否更快:
Is the database query faster if I insert multiple rows at once:
喜欢
INSERT....
UNION
INSERT....
UNION
(我需要插入 2-3000 行)
(I need to insert like 2-3000 rows)
推荐答案
使用VALUES语法的
INSERT语句可以插入多行.为此,请包含多个列值列表,每个列表都用括号括起来并用逗号分隔.
INSERTstatements that useVALUESsyntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas.
示例:
INSERT INTO tbl_name
(a,b,c)
VALUES
(1,2,3),
(4,5,6),
(7,8,9);
来源
相关文章