Insert multiple records with a single insert statement

How can MySQL insert multiple records by executing a single insert statement?

The problem in the hand includes from 1 to 10 entries, depending on the user's input.

+6
sql mysql
source share
1 answer

Just separate the values ​​with a comma.

INSERT INTO tablename (colname1, colname2, colname3) VALUES ('foo1', 'bar1', 'waa1'), ('foo2', 'bar2', 'waa2'), ('foo3', 'bar3', 'waa3') 
+11
source share

All Articles