Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Inserting data from queries eliminates the VALUES clause—doing so actually replaces the clause with the query. The default and override signatures remain the same. Matching the columns returned by the SELECT statement replaces matching VALUES clause columns against the override column list or table definition.
The prototype changes slightly for the INSERT statement when the source becomes the results from a query rather than a list of values. The VALUES keyword must be dropped when you use a query or the INSERT statement fails.
The following prototype works for Oracle and MySQL databases and includes options for joining more than one table on various conditions and uses ANSI SQL-92 syntax:
INSERT INTO table_name
[( column_name1, column_name2, …)]