The INSERT INTO
statement inserts data into a table. The data comes from a subselect query. It is commonly used to input prediction results into a database table.
Here is the syntax:
Please note that the destination table (integration_name.table_name
) must
exist and contain all the columns where the data is to be inserted.
And the steps followed by the syntax:
INSERT INTO
statement to insert the output of the
(SELECT ...)
query into the integration_name.table_name
table.On execution, we get:
We want to save the prediction results into the int1.tbl1
table.
Here is the schema structure used throughout this example:
Where:
Name | Description |
---|---|
int1 | Integration where the table that stores prediction results resides. |
tbl1 | Table that stores prediction results. |
predictor_name | Name of the model. |
int2 | Integration where the data source table used in the inner SELECT statement resides. |
tbl2 | Data source table used in the inner SELECT statement. |
Let’s execute the query.
On execution, we get: