TO TABLE tablename
When a command such as insert, delete, update, or select into modifies or attempts to modify one or more rows of a table, the “TO TABLE” message displays the name of the target table. For operations that require an intermediate step to insert rows into a worktable, “TO TABLE” indicates that the results are going to the “Worktable” table rather than to a user table. This insert command shows the use of the “TO TABLE” statement:
insert sales values ("8042", "QA973", "12/7/95")
QUERY PLAN FOR STATEMENT 1 (at line 1). STEP 1 The type of query is INSERT. The update mode is direct. TO TABLE sales
Here is a command that performs an update:
update publishers set city = "Los Angeles" where pub_id = "1389"
QUERY PLAN FOR STATEMENT 1 (at line 1). STEP 1 The type of query is UPDATE. The update mode is direct. FROM TABLE publishers Nested iteration. Using Clustered Index. Index : publ_id_ix Forward scan. Positioning by key. Keys are: pub_id ASC Using I/O Size 2 Kbytes for index leaf pages. With LRU Buffer Replacement Strategy for index leaf pages. Using I/O Size 2 Kbytes for data pages. With LRU Buffer Replacement Strategy for data pages. TO TABLE publishers
The update query output indicates that the publishers table is used as both the “FROM TABLE” and the “TO TABLE”. In the case of update operations, the optimizer needs to read the table that contains the row(s) to be updated, resulting in the “FROM TABLE” statement, and then needs to modify the row(s), resulting in the “TO TABLE” statement.