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?
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?
Use a UNION:
UNION ALL
is quicker thanUNION
, becauseUNION
removes duplicates --UNION ALL
does not.Start from version 2012-03-20 (3.7.11), sqlite support the following INSERT syntax:
Read documentation: http://www.sqlite.org/lang_insert.html
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: