O'Reilly logo

Practical SQL Handbook, The: Using SQL Variants, Fourth Edition by Sandra L. Emerson, Marcy Darnovsky, Judith S. Bowman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding New Rows: INSERT

The INSERT statement allows you to add rows to the database in two ways:

  • With the VALUES keyword

  • With a SELECT statement

Inserting Data into All Columns with VALUES

The VALUES keyword specifies data values for some or all of the columns in a new row. A generalized version of the syntax for the INSERT command using the VALUES keyword is the following:

INSERT INTO table_name [(column1 [, column2]...)]
VALUES (constant1 [, constant2]...)

This INSERT statement adds a new row to the publishers table, giving a value for every column in the row:

SQL
insert into publishers
values ('1622', 'Jardin, Inc.', '5 5th Ave.', 'Camden', 'NJ')

Notice that you have to type the data values in the same order as the column names in the original ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required