INSERT Statement

The SQL INSERT statement can be used as a convenient way of adding records to database tables. The general form of the INSERT statement is as follows:

INSERT INTO <tablename> (<Field1>, <Field2>)
    VALUES (<Value1>, <VALUE2>)

If you are adding values for each of the fields in the table, and the fields are supplied in the same order as they occur in the table, you can use an alternate form of INSERT which does not require you to specify the field names:

INSERT INTO <tablename>
    VALUES (<Value1>, <VALUE2>)

You need to be careful using this form of INSERT since the statement will fail if the table structure is changed by, for example, adding new fields.

For the customer added earlier in the chapter, the following insert statements ...

Get Windows® CE 3.0 Application Programming 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.