Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert multiple rows into a SQLite 3 table?

In MySQL I'd use

INSERT INTO `mytable` (`col1`, `col2`) VALUES
  (1, 'aaa'),
  (2, 'bbb');

but this causes an error in SQLite. What is the correct syntax for SQLite?

like image 737
Ivan Avatar asked Apr 06 '12 03:04

Ivan


1 Answers

This has already been answered before here: Is it possible to insert multiple rows at a time in an SQLite database?

To answer your comment to OMG Ponies answer:

As of version 3.7.11 SQLite does support multi-row-insert. Richard Hipp comments:

"The new multi-valued insert is merely syntactic suger (sic) for the compound insert. 
There is no performance advantage one way or the other."
like image 176
Leo Correa Avatar answered Dec 14 '22 00:12

Leo Correa