MySQL中批量寫入數據的方式有以下幾種:
INSERT INTO table_name (column1, column2, column3) VALUES
(value1, value2, value3),
(value4, value5, value6),
(value7, value8, value9);
INSERT INTO table_name (column1, column2, column3)
SELECT column1, column2, column3
FROM source_table
WHERE condition;
LOAD DATA INFILE ‘file_name.txt’
INTO TABLE table_name
FIELDS TERMINATED BY ‘,’
LINES TERMINATED BY ‘\n’;
INSERT INTO table_name (column1, column2, column3)
VALUES (value1, value2, value3),
(value4, value5, value6),
…
(valueN, valueN+1, valueN+2);
以上是MySQL中批量寫入數據的常用方式,根據具體需求可以選擇適合的方式進行批量寫入。