Sometimes, it is needed to insert multiple columns at a time. Next MySQL multiple insert queries performs perfect, of course
But next single query is easy to use and save memory ant time
But be careful with large data (value). Your server or machine might be stop the execution due to the security or resource issues such as execution time limit.
INSERT INTO
table_name (column-1, column-2, ... , column-n)
VALUES (value-1-1, value-1-2, ... , value-1-n);
INSERT INTO
table_name (column-1, column-2, ... , column-n)
VALUES (value-2-1, value-2-2, ... , value-2-n);
...
INSERT INTO
table_name (column-1, column-2, ... , column-n)
VALUES (value-m-1, value-m-2, ... , value-m-n);
table_name (column-1, column-2, ... , column-n)
VALUES (value-1-1, value-1-2, ... , value-1-n);
INSERT INTO
table_name (column-1, column-2, ... , column-n)
VALUES (value-2-1, value-2-2, ... , value-2-n);
...
INSERT INTO
table_name (column-1, column-2, ... , column-n)
VALUES (value-m-1, value-m-2, ... , value-m-n);
But next single query is easy to use and save memory ant time
INSERT INTO
table_name (column-1, column-2, ... , column-n)
VALUES
(value-1-1, value-1-2, ... , value-1-n),
(value-2-1, value-2-2, ... , value-2-n),
... ,
(value-m-1, value-m-2, ... , value-m-n);
table_name (column-1, column-2, ... , column-n)
VALUES
(value-1-1, value-1-2, ... , value-1-n),
(value-2-1, value-2-2, ... , value-2-n),
... ,
(value-m-1, value-m-2, ... , value-m-n);
But be careful with large data (value). Your server or machine might be stop the execution due to the security or resource issues such as execution time limit.
Comments
Post a Comment