The INSERT statement inserts one or more rows into a table using the values provided.
This statement can be issued through the DB2eCLP.
>>-INSERT INTO--table-name--+-----------------------+-----------> | .-,-----------. | | V | | '-(----column-name-+--)-' .-,--------------. V | >--+-VALUES--(----| expression |-+--)-+------------------------>< '-SELECT-statement-----------------' expression .-Operator---------------------. V | |----+----+--+-literal----------+-+-----------------------------| +-+--+ +-special register-+ '- --' +-function---------+ '-( expression )---' operator |--+-/--+-------------------------------------------------------| +-*--+ +-+--+ '- --'
Omission of the column list is an implicit specification of a list in which every column of the table is identified in left-to-right order.
The number of values for each row must equal the number of names in the column list. The first value is inserted in the first column in the list, the second value in the second column, and so on.
Arithmetic operations on CHAR, VARCHAR, BLOB(n), DATE, TIME and TIMESTAMP data types are not supported.
INSERT INTO EMPLOYEE
VALUES ('002001', 'John', 'Harrison', '600', '4900', 50000, '01/12/1989')
INSERT INTO EMPLOYEE (EMPNO, FIRSTNAME, LASTNAME)
VALUES ('003002', 'Jim', 'Gray')
CREATE TABLE EMP_ACT_COUNT
( EMPNO CHAR(6) NOT NULL,
COUNT INTEGER)
INSERT INTO EMP_ACT_COUNT
SELECT EMPNO, COUNT(*)
FROM EMP_ACT
GROUP BY EMPNO