I will say 100 rows of data to insert into the MySQL database table.But I do not want to write all 100 INSERT statements.Is there a bulk insert of Statement in SQL ??? Please help with the code if possible.
INSERT
INSERT INTO tbl (col1, col2) VALUES ('val1', 'val2'), ('val3', 'val4'), ...
And read the documentation next time
As a guide to MySQL, it is indicated:
OperatorsINSERT that use the VALUES syntax can insert multiple rows. To do this, include several lists of column values, each of which is enclosed in parentheses and separated by commas. Example: INSERT INTO tbl_name (a, b, c) VALUES (1,2,3), (4,5,6), (7,8,9);
INSERT that use the VALUES syntax can insert multiple rows. To do this, include several lists of column values, each of which is enclosed in parentheses and separated by commas. Example:
VALUES
INSERT INTO tbl_name (a, b, c) VALUES (1,2,3), (4,5,6), (7,8,9);
Also, from the INSERT speed section:
If you are inserting many rows from the same client at the same time, use INSERT with multiple VALUES lists to insert multiple rows at a time. This is significantly faster (in many cases faster) than using separate single-line INSERT . If you are adding data to a non-empty table, you can configure the variable bulk_insert_buffer_size to make data insertion even faster. See Section 5.1.3, βServer System Variablesβ .
bulk_insert_buffer_size
Source: https://habr.com/ru/post/1486404/More articles:Django `with` does not recognize keyword argument - pythonSeparate subsequences summing a given number in an array - algorithmcould not find vcvarsall.bat - pythonSQL is needed to sort the table based on another array list - sqlGUI library: how long does it take to write one from scratch? - c ++PHP: redirect one page after clicking submit - redirectJersey should not use any form parameter. exception is javaOdd error RTCReporting - iosSymfony / Doctrine: DateTime as primary key - datetimePython program is very slow - performanceAll Articles