The INTO TABLE clause may be used with any valid SELECT query in order to create a
new table with the column structure and row data of the returned result set. The syntax for this is as follows:
INTO [ TABLE ]
This syntax performs an implicit CREATE TABLE command, creating a table with the same
column names, value types, and row data as the result set from the original table. When the message
SELECT is returned, you will know that the statement was successfully performed, and
the new table created. This is demonstrated in Example 4-52, which creates a backup table
called stock_backup out of the data in the stock table.
Example 4-52. Using SELECT INTO
SELECT * INTO stock_backup
The table specified by the INTO clause must not exist, or else an error will be
returned. Upon the error, the values of the query will not be inserted and the
query will fail. Note that the TABLE keyword, in this query, is an optional noise term.