Javatpoint Logo
Javatpoint Logo

SQL INSERT INTO SELECT

We know how to insert a single row or an individual data in a table at a time, but if you want to insert multiple rows in a table. In addition to INSERT INTO you will combine it with the select statement.

In this command, you are using information from another table.

Let's see the Syntax for sql insert into select:

The INSERT INTO statement can also contain many clauses like SELECT, GROUP BY, HAVING as well as JOIN and ALIAS. So the insert into select statement may be complicated some times.

Let?s take an example:

There is a table, named sales_data in a database name departmental store while table store_information contains the record of those data which are sold from the store per day. If you want to move data from sales_data to store_information

You should use the following syntax:





Please Share

facebook twitter google plus pinterest tumbler

Latest 4 Tutorials