SQL INSERT

The INSERT INTO statement is used to insert new rows into a table.

You can insert a new row in a table in two ways:

INSERT INTO tablename VALUES (value1, value2, value3, ...)

INSERT INTO tablename (column1, column2, column3, ...) VALUES (value1, value2, value3, ...)

Example:

Given the following table people:

namesurnamenickname
HARRYCLARKWHITE
WILLIAMJONESCLARK
HARRYSMITHBENITO

If we insert a new row in the table people, we can do with any of the following two statements:

INSERT INTO people VALUES ('JOHN', 'BROWN', 'ANDERSON')

INSERT INTO people (name, surname, apellido2) VALUES ('JOHN', 'BROWN', 'ANDERSON')

Any of the above statements produces to insert a new row in the table people, thus leaving this table:

namesurnamenickname
HARRYCLARKWHITE
WILLIAMJONESCLARK
HARRYSMITHBENITO
JOHNBROWNANDERSON