Inserting Rows with INSERT

The INSERT statement adds new rows to a table. In this section, I’ll explain how to use several variations of INSERT to:

  • Insert a row by using column positions (INSERT VALUES)

  • Insert a row by using column names (INSERT VALUES)

  • Insert rows from one table into another table (INSERT SELECT)

The important characteristics of INSERT are:

  • In a positional insert, you insert ordered values into a new row in the same sequence as the columns appear in a table (see “To insert a row by using column positions” later in this section). In a named-column insert, you name the specific column into which each value is inserted in the new row (see “To insert a row by using column names” later in this section).

    You always should use a named-column ...

Get SQL: Visual QuickStart Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.