INSERT

The INSERT statement adds a new record to a database table. There are two main variations on the INSERT statement. The first explicitly lists the names of the fields for which the statement is specifying values:

INSERT INTO table_name 
(field1, field2, ...) 
VALUES (value1, value2, ...) 

To insert a NULL value in a field, simply omit the field. For example, suppose the People table has the fields LastName, FirstName, and PhoneNumber. The following statement creates a new record with a NULL PhoneNumber value:

INSERT INTO People 
(LastName, FirstName) 
VALUES ('Crissy', 'Canon') 

Alternatively, you can list the field and explicitly give it a NULL value as in this example:

 INSERT INTO People (LastName, FirstName, PhoneNumber) VALUES ('Crissy', ...

Get Visual Basic® .NET Database 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.