---
title: "The SQL INSERT INTO SELECT Statement"  
description: "The SQL INSERT INTO SELECT Statement"  
author: "Manish Kumar"  
published: 2017-12-18  
updated: 2020-09-21  
canonical: https://www.mindstick.com/interview/23338/the-sql-insert-into-select-statement  
category: "database"  
tags: ["database", "sql server"]  
reading_time: 1 minute  

---

# The SQL INSERT INTO SELECT Statement

It copies data from one table and paste it into another table. \

INSERT INTO SELECT requires same data types in source and target tables match

The existing records in the target table are unaffected

##### INSERT INTO SELECT Syntax

Copy all columns from one table and paste into another table:

```
INSERT INTO table2
SELECT * FROM table1
WHERE condition;
```

Copy only some columns from one table and paste into another table:

```
INSERT INTO table2 (column1, column2, column3, ...)
SELECT column1, column2, column3, ...
FROM table1
WHERE condition;
```

## Answers

### Answer by Manish Kumar

It copies data from one table and paste it into another table. \

INSERT INTO SELECT requires same data types in source and target tables match

The existing records in the target table are unaffected

##### INSERT INTO SELECT Syntax

Copy all columns from one table and paste into another table:

```
INSERT INTO table2
SELECT * FROM table1
WHERE condition;
```

Copy only some columns from one table and paste into another table:

```
INSERT INTO table2 (column1, column2, column3, ...)
SELECT column1, column2, column3, ...
FROM table1
WHERE condition;
```


---

Original Source: https://www.mindstick.com/interview/23338/the-sql-insert-into-select-statement

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
