sqlcmd.net validated sql reference
beginner inserting MySQL MariaDB SQL Server PostgreSQL SQLite

Insert Multiple Rows

Add several rows in one statement using a multi-value `INSERT`.

Docker-validated Not currently validation-green

Insert three rows in one statement

One INSERT statement creates all three rows, then the follow-up query verifies the final state.

Rows loaded before the example query runs.
Setup
CREATE TABLE teams (id INT, name VARCHAR(50));
Shared across supported engines.
SQL
INSERT INTO
  teams (id, name)
VALUES
  (1, 'Alpha'),
  (2, 'Bravo'),
  (3, 'Charlie');

SELECT
  id,
  name
FROM
  teams
ORDER BY
  id;
Returned rows for the shared example.
idname
1Alpha
2Bravo
3Charlie

Each engine supports the same multi-row insert form used here.

Where this command helps.

  • seeding sample data for a new table
  • inserting a small batch of rows from one application action

What the command is doing.

A multi-row INSERT lets you add several rows in one statement instead of issuing separate inserts. This is common for seed data, small batch imports, and reducing round trips from an application.