Mirgorod
Mirgorod

Reputation: 32673

How to insert many items in one SQL query?

I have 20 items. Is it possible to insert 20 items only with one query (without loops)?

Upvotes: 0

Views: 162

Answers (2)

Dave Kiss
Dave Kiss

Reputation: 10485

INSERT into `table` (`1`,`2`,`3`....`20`) VALUES (`value1`,`value2`,`value3`,...`value20`)

Upvotes: 0

JYelton
JYelton

Reputation: 36512

Look into syntax like this:

INSERT INTO table (column) VALUES (item1), (item2), (item3), ...

Upvotes: 7

Related Questions