9.2. Modifying DB2 Data

You modify DB2 data using the INSERT, UPDATE, and DELETE statements. Most of the clauses and functions described in the previous section also work with these statements. We will use some examples to explain their basic usages.

You can specify all the column values in the INSERT statement like this:

					INSERT INTO employee
					VALUES ( '000998', 'SMITH', 'A', 'JOHN',  NULL, NULL, NULL, NULL, 18,
					'M', NULL, NULL, NULL, NULL ) ;
				

Alternatively, you can explicitly specify the column list for which values will be provided in the INSERT statement:

					INSERT INTO employee (empno, firstnme, midinit, lastname, edlevel)
					VALUES ( '000999', 'SMITH', 'A', 'JOHN', 18 );
				

You can also insert multiple rows in one INSERT statement:

					INSERT INTO ...

Get Understanding DB2®: Learning Visually with Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.