Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

INSERT/SELECT in Teradata

Although INSERT will be the great option to the users for INSERTing data into a table, INSERT/SELECT will give a better option when you want to insert from one or more other tables. The SELECT reads the data values from the one or more columns in one or more tables and uses them as the values to INSERT into another table. Simply put, the SELECT takes the place of the VALUES portion of the INSERT.

This option says : If the data is already present in your warehouse, why are you reloading?, why are you inserting with values?

Syntax:
To insert all the records in all the columns.
INSERT INTO table2
SELECT * FROM table1

To insert records in fewer columns.
INSERT INTO table2
SELECT (column1, column2, column3) FROM table1;
or
INSERT INTO table2 (columna, column b, column c)
SELECT (column1, column2, column3) FROM table1;


You can use SUB QUERIES, AGGREGATE functions also in the SELECT statements but the datatype between the source and target must be the same.
Regardless, it is still very important to list the selected data values to match the sequence of the columns in the CREATE TABLE. The columns to be inserted must be listed in a sequence that matches the columns in the SELECT from the original table.