8. SQL Statements : INSERT : Syntax
 
Share this page                  
Syntax
The INSERT statement has the following format:
[EXEC SQL [REPEATED]]INSERT INTO [schema.]table_name
              [(column {, column})]
              [OVERRIDING SYSTEM VALUE|OVERRIDING USER VALUE]
              [VALUES (expr{, expr})] | [subselect];
REPEATED
Saves the execution plan of the insert, which can make subsequent executions faster. For details, see Repeated Queries (see Repeated Queries).
column {,column}
Identifies the columns of the specified table into which the values are placed. When the column list is included, the DBMS Server places the result of the first expression in the values list or subselect into the first column named, the second value into the second column named, and so on. The data types of the values must be compatible with the data types of the columns into which they are placed.
OVERRIDING SYSTEM VALUE
Overrides the sequence value for a GENERATED ALWAYS AS IDENTITY column with the explicit value specified in the VALUES clause. See CREATE TABLE.
OVERRIDING USER VALUE
Overrides the sequence value for a GENERATED BY DEFAULT IDENTITY column with the explicit value specified in the VALUES clause. See CREATE TABLE.
VALUES (expr{,expr} | subselect
Specifies an individual value or list of values to be inserted, or specifies a subselect.
When using the values list, only a single row can be inserted with each execution of the statement.
If a column corresponding to an expr is the identity column and there is no OVERRIDING clause, the value must be DEFAULT.
If specifying a subselect, the statement inserts all the rows that result from the evaluation of the subselect. For the syntax of subselect, see Select (interactive) (see SELECT (interactive)).