INSERT Statement

Adds new rows into a table.

Syntax

INSERT INTO table-name {(column-identifier{,column-identifier}...)} [query-specification || VALUES (insert-value{,insert-value}...)]

Syntax Elements

table-name =
{owner-name.}table-identifier

owner-name
The SQL user-id of the creator of the table

table-identifier
The name of the required table.

column-identifier
Any user-defined name (except a Reserved Word) starting with a letter and comprising up to 49 letters, underscores and/or numbers. Letters are case sensitive.

query-specification =
SELECT {[ALL || DISTINCT]} select-list FROM table-reference-list {WHERE search-condition} {GROUP BYcolumn-name {,column-name{...}}} {HAVING search-condition}

Refer to the SELECT statement for full definition.

insert-value =
dynamic-parameter || literal || NULL || USER

dynamic-parameter =
?

literal =
character string, numeric or date value. Refer to the topic SQL Expression.

Restrictions

The user performing this statement requires SQL INSERT privileges.

Comment

If no column-identifier list is specified, this statement uses a default list consisting of all columns in the table in the order they were defined. This is the same list as is used in a "SELECT * FROM table" statement.

Examples

INSERT INTO EMP (EMPNO, ENAME, TITLE) VALUES(1234, 'SMITH?, ?AUTHOR?)
INSERT INTO EMP2 SELECT * FROM EMP WHERE DEPTNO = 90020