Introduction to DB2 for z/OS
|
Previous topic |
Next topic |
Contents |
Glossary |
Contact z/OS |
PDF
Insert statements Introduction to DB2 for z/OS |
|
|
You can use an INSERT statement to add new rows to a table or view. You can use an INSERT statement to take the following actions:
You can add new data to an existing table in other ways, too. You might need to add large amounts of data to an existing table. Some efficient options include copying a table into another table, writing an application program that enters data into a table, and using the DB2 LOAD utility to enter data. Suppose that you want to add a new row to the NEWDEPT table. Use this INSERT statement: INSERT INTO NEWDEPT (DEPTNO, DEPTNAME, MGRNO, ADMRDEPT)
VALUES ('E31', 'PUBLISHING', '000020', 'D11');
After inserting the new department row into the NEWDEPT table, you can use a SELECT statement to see what the modified table looks like. Use this query: SELECT * FROM NEWDEPT WHERE DEPTNO LIKE 'E%' ORDER BY DEPTNO; The result table gives you the new department row that you inserted for department E31 and the existing departments with a department number beginning in E. DEPTNO DEPTNAME MGRNO ADMRDEPT ====== ================ ====== ======== E21 SOFTWARE SUPPORT ------ D11 E31 PUBLISHING 000020 D11 |
Copyright IBM Corporation 1990, 2010 |