We can insert data to a table by selecting data from another table using SQL INSERT INTO SELECT Statement. In this lesson, I will show you how we can do that.
INSERT INTO first_table
SELECT * FROM another_table
WHERE condition;
INSERT INTO customers
SELECT * FROM employees;
INSERT INTO customers
SELECT * FROM employees
WHERE country = "USA";
INSERT INTO first_table (column1, column2, column3)
SELECT column1, column2, column3
FROM another_table
WHERE condition;
INSERT INTO customers (name, email, gender)
SELECT name, email, gender
FROM employees
WHERE gender = 'male';