Published Jun 26, 2021Updated Jul 13, 2022
Contribute to Docs

The INSERT INTO command creates and places new rows into a table.


INSERT INTO table_name
VALUES (value1, value2, ...);

Multiple rows can be inserted by adding additional sets to the VALUES clause:

INSERT INTO table_name
  (value1, value2, ...),
  (value1, value2, ...);

To add values corresponding to only specific columns, thereby leaving the rest of the row as default values, specify them alongside the table name:

INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);

Default values can also be added using the DEFAULT keyword for the relevant column value:

INSERT INTO table_name
VALUES (value1, DEFAULT, value3, ...);


The given query adds a new student to a students table, providing values for first_name, last_name, and enrollment_date, thereby inserting default values for all other columns:

INSERT INTO students (first_name, last_name, enrollment_date)
VALUES ('Jeremy', 'Barbosa', '2016-09-01');

All contributors

Looking to contribute?

Learn SQL on Codecademy