Modifying Db2 data

You can use SQL statements to add, modify, merge, and remove data in existing tables. You can use the INSERT, UPDATE, MERGE, TRUNCATE, and DELETE statements to manipulate Db2 data.

If you insert, update, merge, or delete data, you can retrieve the data immediately. If you open a cursor and then modify data, you see the modified data only in some circumstances.

Any modifications must maintain the integrity of table relationships. Db2 ensures that an insert, update, or delete operation does not violate any referential constraint or check constraint that is defined on a table.

Before modifying data in your tables, create duplicate tables for testing purposes so that the original table data remains intact. Assume that you created two new tables, NEWDEPT and NEWEMP, that duplicate the DEPT and EMP tables.