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

后端 未结 24 2871
猫巷女王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:43

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

    I'm using 3.6.13

    I command like this:

    insert into xtable(f1,f2,f3) select v1 as f1, v2 as f2, v3 as f3 
    union select nextV1+, nextV2+, nextV3+
    

    With 50 records inserted at a time, it takes only a second or less.

    It's true using sqlite to insert multiple rows at a time is very possible. By @Andy wrote.

    thanks Andy +1

提交回复
热议问题