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

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

    Yes, as of SQLite 3.7.11 this is supported in SQLite. From the SQLite documentation:

    SQLite INSERT statement syntax

    (when this answer was originally written, this was not supported)

    For compatibility with older versions of SQLite, you can use the trick suggested by andy and fearless_fool using UNION, but for 3.7.11 and later the simpler syntax described in here should be preferred.

提交回复
热议问题