Populate a table using query results.
Section: INSERT, UPDATE, and DELETE
Insert from select
sql
sql
INSERT INTO active_customers (customer_id, email)
SELECT customer_id, email
FROM customers
WHERE status = "active";Explanation
Great for staging and snapshot tables.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing INSERT, UPDATE, and DELETE