Inserting Data into a Table


To insert data into a table, use the following SQL INSERT syntax:


INSERT INTO myTable
(columnOne, columnTwo, columnThree, columnFour)
VALUES ('col1Value', 'col2Value', col3Number, 'col4Value')


It is also acceptable to omit the column names in an INSERT statement. When the column names are omitted, the values supplied in the INSERT statement will be applied in the order that the columns were created with CREATE TABLE.
Given the CREATE TABLE sample provided in the previous section, the following is a valid SQL INSERT statement:


INSERT INTO myTable
VALUES ('col1Value', 'col2Value', col3Number, 'col4Value')


SQL INSERT statements are required to provide the data to be inserted in the VALUES clause. The use of a sub-select to provide data to an INSERT statement is not supported in this release. The use of a sub-select in an INSERT statement will produce unexpected results.

If it is necessary to insert a NULL value you can do this by specifying the column value as ''. (two single quotes with no space inbetween)

 
 

DBLX SQL Guide