O'Reilly logo

Microsoft® SQL Server™ 2000 Programming by Example by Carlos Eduardo Rojas, Fernando G. Guerrero

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

Modifying Data

As you already know, SELECT is the element of the Data Manipulation Language (DML) that is used to extract information from tables. The other elements of the DML are used to add, modify, and remove data from tables. These elements are INSERT, UPDATE, and DELETE.

The INSERT Statement

INSERT is used to add new rows in a table. The following is the basic syntax to insert a row in a table:

INSERT INTO Table_name (column_1,column_2,..,column_n)
VALUES (value_1,value_2,..,value_n)

The order of the values to be inserted must be the same order of the columns specified in the column list. Also, the INTO keyword can be omitted when using the INSERT statement, as shown in Listing 4.33.

Code Listing 4.33. Adding a New Row Using the INSERT ...

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