bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL INSERT INTO SELECT Keyword

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind SQL INSERT INTO SELECT Keyword?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ INTO Customers (CustomerName,
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The following SQL copies "Suppliers" into "Customers" (the columns that are not filled with data, will contain NULL):
The INSERT INTO SELECT command copies data from one table and inserts it into another table.
Insert Into Select

Insert Into Select

The INSERT INTO SELECT command copies data from one table and inserts it into another table.

The following SQL copies "Suppliers" into "Customers" (the columns that are not filled with data, will contain NULL):

Example

INSERT INTO Customers (CustomerName,
 City, Country)
 SELECT SupplierName, City, Country FROM Suppliers;

The following SQL copies "Suppliers" into "Customers" (fill all columns):

Example

INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode,
 Country)
SELECT SupplierName, ContactName, Address, City, PostalCode,
 Country FROM Suppliers;

The following SQL copies only the German suppliers into "Customers":

Example

INSERT INTO Customers (CustomerName,
 City, Country)
 SELECT SupplierName, City, Country FROM Suppliers
WHERE Country='Germany';

Previous

SQL INSERT INTO Keyword

Next

SQL IS NULL Keyword