Skip to main content
 

Creating a table in Teradata

1 min read

1. Creating a Volatile table / permanent table first and then inserting into it 

Ex:

````

STEP1: 

CREATE VOLATILE TABLE ,

NO FALLBACK, NO JOURNAL, NO LOG

(COLUMN1 DEF)

PRIMARY INDEX (COLUMN1)

ON COMMIT PRESERVE ROWS;

 ````

STEP2:

```` 

INSERT INTO (

SELECT COLUMN1 FROM TABLE2

);

 ````

 

2. Creating a table on the fly using a SELECT statement results 

````

CREATE VOLATILE TABLE ,

NO FALLBACK, NO JOURNAL, NO LOG

AS (

SELECT COLUMN1 FROM TABLE2

) WITH DATA

PRIMARY INDEX (COLUMN1)

ON COMMIT PRESERVE ROWS;

````

 

https://forums.teradata.com/forum/database/difference-between-create-table-statements