#What is the method for adding data in batches using sql statements?
Method 1: Execute one by one, slow .
INSERT INTO testimport (name, message)VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd'); INSERT INTO testimport (name, message)VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd'); INSERT INTO testimport (name, message)VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd');
Method 2: Batch execution, suitable for SQL Server.
INSERT INTO testimport (name, message) VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd'), ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd'), ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd');
Method 3: Batch execution, suitable for Oracle.
INSERT ALL INTO A (name, message) VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd') INTO A (name, message) VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd') INTO A (name, message) VALUES ('testname', 'jfksdfkdsfjksadljfkdsfjsdlafjdaslkfjasfd') SELECT 1 FROM DUAL;
Recommended tutorial: "sql tutorial"
The above is the detailed content of What is the method to add data in batches using sql statements?. For more information, please follow other related articles on the PHP Chinese website!