Oracle INSERT INTO SELECT: Query Results to Table

In Oracle, you can use the INSERT INTO statement to insert the query results into a table. Here is an example:

Suppose you have a table named target_table with columns column1, column2, and column3. You want to insert data from another table named source_table that matches specific conditions into target_table. You can use the following SQL statement:

INSERT INTO target_table (column1, column2, column3)
SELECT column1, column2, column3
FROM source_table
WHERE condition = 'your_condition';

In this example, you need to insert data from the source_table that meets the condition = ‘your_condition’ into the target_table. Ensure that the column names and data types in the target_table match those in the source_table.

After executing the SQL statement above, the data that meets the requirements will be inserted into the target_table.

bannerAds