How To Write Insert Into Select Query In SQL

In this article, we will learn how to write a SQL insert into select query.

To copy data from one table and insert it into another table in SQL, the INSERT INTO SELECT statement is used.

  • Data types in source and target table should match.
  • Existing records in the target table are unaffected.


INSERT INTO TABLE_NAME2 (column1, column2, ...columnN)
SELECT column1, column2, ...columnN FROM TABLE_NAME1;


The subsequent statement would copy data from Article and insert into Backup_Article:

INSERT INTO Backup_Article (Name, Views)
SELECT Name, Views FROM Article;


Also, check How To Write Select Into Query In SQL

Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories