About this question
What if you want to insert multiple rows into a table by selecting them from another? This technique allows you to copy data efficiently from one table to another using INSERT INTO ... VALUES (SELECT ... FROM ...).
What if you want to insert multiple rows into a table by selecting them from another? This technique allows you to copy data efficiently from one table to another using INSERT INTO ... VALUES (SELECT ... FROM ...).
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask MS SQL Server Expert
Answered on May 18, 2025
If you want to insert data into a table by selecting it from another, SQL makes this pretty straightforward using the INSERT INTO ... SELECT ... FROM ... syntax. This method is super useful when you need to migrate or duplicate data across tables without manually inputting every row.
Here’s how it works:
INSERT INTO target_table (column1, column2)
SELECT column1, column2 FROM source_table
WHERE condition;Why use this method?
Example:
Imagine you have a table called employees_temp and you want to move the employees who joined in 2024 to the main employees table:
INSERT INTO employees (id, name, department)
SELECT id, name, department FROM employees_temp
WHERE join_year = 2024;A few tips:
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Step-by-step SQL Server guides from industry experts
Common SQL Server interview questions, answered
Guides, tips and career advice on SQL Server from JanBask experts.
SQL Server Top 75 SSAS Interview Questions and Answers For Beginners & Experts
Prepare for your SSAS interview with our comprehensive guide featuring 75 top SQL Server Analysis Services interview questions…
SQL Server How to Become a SQL Database Administrator?
How to become a sql database administrator In 2025, discover what these professionals do, explore how much they earn and learn…
SQL Server OLAP vs OLTP: Key Differences, Architectures, Performance & Real-World Examples
Compare OLTP vs OLAP with clear definitions, architecture diagrams, real-world examples, and FAQs. Learn when to use each system…
SQL Server 70+ Most Asked SSIS Interview Questions for Freshers & Experienced
Prepare for your next SQL Server Integration Services (SSIS) interview with our top 70+ SSIS interview questions and answers.…