MySQL INSERT INTO SELECT Statement
Copying data directly from one table and inserting into another target table.
-- Create target table for archived high earners
CREATE TABLE top_earners (
emp_id INT PRIMARY KEY,
full_name VARCHAR(100),
salary DECIMAL(10,2)
);
-- Copy matching records from employees table
INSERT INTO top_earners (emp_id, full_name, salary)
SELECT employee_id, CONCAT(first_name, ' ', last_name), salary
FROM employees
WHERE salary >= 60000;Query OK, 3 rows affected (0.01 sec) Records: 3 Duplicates: 0 Warnings: 0