15.10 - Example: AS … WITH DATA With a Nonunique Secondary Index - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
SQL_DDL_15_10.ditamap
dita:ditavalPath
ft:empty

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 (
       column_1,
       column_2)
     AS (SELECT *
         FROM subquery_table )
     WITH DATA
     INDEX (column_2);