INSERT
Inserts rows of data into a table or updatable view
INSERT INTO target { DEFAULT VALUES | [(<column_list>)] [<override_opt>] <value-source> } [RETURNING <returning_list> [INTO <variables>]] <column_list> ::= col_name [, col_name ...] <override_opt> ::= OVERRIDING {USER | SYSTEM} VALUE <value-source> ::= VALUES (<value-list>) | <query-expression> <value-list> ::= <ins-value> [, <ins-value> ...] <ins-value> :: = <value-expression> | DEFAULT <returning_list> ::= * | <output_column> [, <output_column] <output_column> ::= target.* | <return_expression> [COLLATE collation] [[AS] alias] <return_expression> ::= <value-expression> | [target.]col_name <value-expression> ::= <literal> | <context-variable> | any other expression returning a single value of a Firebird data type or NULL <variables> ::= [:]varname [, [:]varname ...]
Argument | Description |
---|---|
target |
The name of the table or view to which a new row, or batch of rows, should be added |
col_name |
Name of a table or view column |
value-expression |
An expression whose value is used for inserting into the table or for returning |
return_expression |
The expression to be returned in the |
literal |
A literal |
context-variable |
Context variable |
varname |
Name of a PSQL local variable |
The INSERT
statement is used to add rows to a table or to one or more tables underlying a view:
-
If the column values are supplied in a
VALUES
clause, exactly one row is inserted -
The values may be provided instead by a
SELECT
expression, in which case zero to many rows may be inserted -
With the
DEFAULT VALUES
clause, no values are provided at all and exactly one row is inserted.
Note
|
Restrictions
|
Important
|
ALERT :
BEFORE INSERT TriggersRegardless of the method used for inserting rows, be mindful of any columns in the target table or view that are populated by |