INSERT INTO SELECT copies rows from one table and inserts them directly into another existing table.
-- Copy inactive customers to an archive table
INSERT INTO archived_customers (customer_id, first_name, last_name, email)
SELECT customer_id, first_name, last_name, email
FROM customers
WHERE is_active = 0;
Write a query that inserts all products with zero inventory into an out_of_stock_catalog table.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With