--format
INSERT INTO Customers (CustomerName, City, Country)
SELECT SupplierName, City, Country FROM Suppliers;
--examples
INSERT INTO Customers (CustomerName, City, Country)
SELECT SupplierName, City, Country FROM Suppliers;
INSERT INTO user_profile (
name,
client_id,
email_id,
mobile,
create_date,
last_modified
)
SELECT
name,
client_id,
email_id,
mobile,
now(),
now()
FROM
user_profile
WHERE
id = 106
INSERT INTO my_table SELECT * FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table s
WHERE s.my_col >= 10;
INSERT INTO OldCustomers
SELECT *
FROM Customers;
INSERT INTO table_name(column_list)
SELECT
select_list
FROM
another_table
WHERE
condition;
Code language: SQL (Structured Query Language) (sql)