SQL VOEG IN KIESE Sleutelwoord in
VOEG IN SELECTEER
Die INSERT INTO SELECT
opdrag kopieer data van een tabel en voeg dit in 'n ander tabel in.
Die volgende SQL kopieer "Verskaffers" na "Klante" (die kolomme wat nie met data gevul is nie, sal NULL bevat):
Voorbeeld
INSERT INTO Customers (CustomerName,
City, Country)
SELECT SupplierName, City, Country FROM Suppliers;
Die volgende SQL kopieer "Verskaffers" na "Klante" (vul alle kolomme):
Voorbeeld
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode,
Country)
SELECT SupplierName, ContactName, Address, City, PostalCode,
Country FROM Suppliers;
Die volgende SQL kopieer slegs die Duitse verskaffers in "Klante":
Voorbeeld
INSERT INTO Customers (CustomerName,
City, Country)
SELECT SupplierName, City, Country FROM Suppliers
WHERE Country='Germany';