本文介紹了在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
語句可以插入多行.為此,請包含多個列值列表,每個列表都用括號括起來并用逗號分隔.
INSERT
statements that useVALUES
syntax 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);
來源
這篇關于在mysql中插入多行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!