Description
TheCREATE TABLE statement creates a table and fills it with a subselect query output. It is usually used to materialize prediction results as tables.
Syntax
You can use the usualCREATE TABLE statement:
CREATE OR REPLACE TABLE statement:
Note that the
integration_name connection must be created with the CREATE DATABASE statement and the user with write access.- It executes a subselect query to get the output data.
- In the case of the
CREATE OR REPLACE TABLEstatement, theintegration_name.table_nametable is dropped before recreating it. - It (re)creates the
integration_name.table_nametable inside theintegration_nameintegration. - It uses the
INSERT INTOstatement to insert the output of the(SELECT ...)query into theintegration_name.table_name.
Example
We want to save the prediction results into theint1.tbl1 table.
Here is the schema structure used throughout this example:
| 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. |