17.05 - Example: AS … WITH DATA With a Nonunique Secondary Index - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Advanced SQL Engine
Teradata Database
Release Number
Release Date
January 2021
Content Type
Programming Reference
Publication ID
English (United States)

This CREATE TABLE … AS … WITH DATA request creates a new NUSI index on column_2 of target_table. The request also copies the data from the selected columns into target_table.

Because the request specifies a subquery and no explicit table kind is specified, the table kind of target_table defaults to the session mode default, not to the table kind of subquery_table.

     CREATE TABLE target_table (
     AS (SELECT *
         FROM subquery_table )
     INDEX (column_2);