INSERT INTO SELECT Statement
Last updated
Last updated
The INSERT INTO SELECT statement copies data from one table and inserts it into another table.
INSERT INTO SELECT requires that data types in source and target tables match
The existing records in the target table are unaffected
Copy all columns from one table to another table:
Copy only some columns from one table into another table:
Demo Database
Below is a selection from the "Customers" table:
And a selection from the "Suppliers" table:
SQL INSERT INTO SELECT Examples
The following SQL statement copies "Suppliers" into "Customers" (the columns that are not filled with data, will contain NULL):
The following SQL statement copies "Suppliers" into "Customers" (fill all columns):
The following SQL statement copies only the German suppliers into "Customers":