Is it possible to insert multiple rows at a time in an SQLite database?

后端 未结 24 2880
猫巷女王i
猫巷女王i 2020-11-21 06:12

In MySQL you can insert multiple rows like this:

INSERT INTO \'tablename\' (\'column1\', \'column2\') VALUES
    (\'data1\', \'data2\'),
    (\'data1\', \'da         


        
24条回答
  •  抹茶落季
    2020-11-21 06:45

    Start from version 2012-03-20 (3.7.11), sqlite support the following INSERT syntax:

    INSERT INTO 'tablename' ('column1', 'column2') VALUES
      ('data1', 'data2'),
      ('data3', 'data4'),
      ('data5', 'data6'),
      ('data7', 'data8');
    

    Read documentation: http://www.sqlite.org/lang_insert.html

    PS: Please +1 to Brian Campbell's reply/answer. not mine! He presented the solution first.

提交回复
热议问题