---
title: "Insert Into with Select SQL: How to Write SQL Query"
description: "The \"Insert Into with Select\" statement in SQL allows transferring and manipulating data between tables efficiently."
url: https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/
date: 2023-01-05
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2022/06/pexels-photo-3769702.jpeg?fit=1639%2C1300&ssl=1
categories: ["SQL"]
type: post
lang: en
---

# Insert Into with Select SQL: How to Write SQL Query

When working with SQL databases, the “Insert Into with Select” statement offers a powerful way [to select](https://srinimf.com/2012/02/02/1131/) data from one table and insert it into another in a single query. This efficient syntax eliminates the need for multiple steps and provides a streamlined approach to database operations. Let’s take a closer look at [how to](https://srinimf.com/2023/01/09/how-to-create-a-table-from-existing-in-oracle/) utilize this functionality for seamless data manipulation and transfer.

![Insert Into with Select SQL](https://i0.wp.com/srinimf.com/wp-content/uploads/2022/06/pexels-photo-6207367.jpeg?resize=1880%2C1245&ssl=1)*Photo by Skylar Kang on Pexels.com*

Table of contents

1. [Insert into with Select](https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/#insert-into-with-select)
2. [SQL Query to Use Insert into with Select](https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/#sql-query-to-use-insert-into-with-select)
3. [Conclusion](https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/#conclusion)

## Insert into with Select

In the INSERT use the [INTO keyword](https://www.sqlshack.com/sql-select-into-statement/) and columns as needed.

```
INSERT INTO my_table1 (a_column1, b_column2, c_column3)
(
SELECT a_column1, b_column2, c_column3
FROM my_table2
WHERE condition
);
```

Sample [SQL Query](https://srinimf.com/2015/02/14/5-more-db2-sql-performance-tips/): Selecting data from one table, you can insert it in[to another table](https://srinimf.com/2015/03/31/db2-v11-copy-data-one-table-to-another/) in a single query.

```
INSERT INTO promotion (deptnum, empname, yearsexp) 
(SELECT deptno, name, exp 
FROM employee 
WHERE exp > 10) ;
```

Employee table

Three columns are present in the employee table. And three rows of data are present in it.

| deptno | name | exp |
| --- | --- | --- |
| A1 | Vishnu | 13 |
| A2 | Ravi | 5 |
| A3 | Mahi | 10 |

*Table data*

Promotion Table

```
Create Table promotion
(deptnum char(05),
empname char(20),
yearsexp number);
```

## SQL Query [to Use In](https://srinimf.com/2018/04/04/sql-query-insert-values/)sert into with Select

The below query writes only one row to the promotion table.

```
INSERT INTO promotion (deptnum, empname, yearsexp) 
(SELECT deptno, name, exp 
FROM employee 
WHERE exp > 10) ;
```

Related[5 Must-Know MySQL Queries for Interview & Practice (With Examples)](https://srinimf.com/2023/07/15/5-top-mysql-sql-queries-you-need-for-practice/)

## Conclusion

The “Insert Into with Select” statement [in SQL](https://srinimf.com/2023/05/13/how-to-convert-rows-to-columns-pivot-function/) provides a powerful and efficient way to transfer and manipulate data between tables in a single query. By eliminating the need for multiple steps, this streamlined approach enhances the overall database operation process.

Related[DB2 SQL Global Temporary Tables top Usage](https://srinimf.com/2010/04/28/db2-temp-table/)

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2023%2F01%2F05%2Fhow-to-write-insert-and-select-in-single-query%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2022%2F06%2Fpexels-photo-3769702.jpeg%3Ffit%3D1200%252C952%26ssl%3D1&description=Insert%20Into%20with%20Select%20SQL%3A%20How%20to%20Write%20SQL%20Query)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2023/01/05/how-to-write-insert-and-select-in-single-query/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Insert%20Into%20with%20Select%20SQL%3A%20How%20to%20Write%20SQL%20Query&body=https%3A%2F%2Fsrinimf.com%2F2023%2F01%2F05%2Fhow-to-write-insert-and-select-in-single-query%2F&share=email)
-

### Like this:

Like Loading…
