Which databases support BATCH INSERT syntax?

171 Views Asked by At

I know, MySQL supports BATCH INSERT syntax like:

INSERT INTO `table_1` values(1, 2, 3), (3, 4, 5), (5, 6, 7);

Is this syntax included in SQL-92 format? If not, witch data bases support this syntax?

1

There are 1 best solutions below

1
On

If you are concerned about portability, many databases support:

INSERT INTO "table_1"
    select 1, 2, 3 union all
    select 3, 4, 5 union all
    select 5, 6, 7;

(Offhand, SQL Server, Postgres, MySQL, Teradata.)

And most of the rest support:

INSERT INTO "table_1"
    select 1, 2, 3 from dual union all
    select 3, 4, 5 from dual union all
    select 5, 6, 7 from dual;

(Offhand, Oracle, MySQL)

Access and DB2 (offhand) don't support either of these syntaxes.