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');


Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn SQL on Codecademy