The INSERT INTO SELECT statement copies data from one table and inserts it into another table.
The INSERT INTO SELECT statement requires that the data types in source and target tables matches.
Note: 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:
In this tutorial we will use the well-known Northwind sample database.
Below is a selection from the "Customers" table:
And a selection from the "Suppliers" table:
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":