How to insert rows

Insert one row

Name target columns explicitly, then supply values in the same order.

INSERT INTO students (name, city)
VALUES ('Ada', 'Nairobi');

Insert several rows

SQLite, PostgreSQL, and modern MySQL accept comma-separated value rows.

INSERT INTO students (name, city)
VALUES ('Lin', 'Accra'),
       ('Sam', 'Kigali');

Use defaults

Omitted columns receive their declared default or NULL if allowed. Required columns without defaults must be supplied.

Parameterize applications

Application code should send values as parameters through its database library. Do not build SQL by concatenating user input; placeholders differ by driver.