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 ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.