16.20 - Example: AS … WITH NO DATA With a Nonunique Secondary Index - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-24
dita:mapPath
wkf1512081455740.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval

This CREATE TABLE … AS … WITH NO DATA request creates a NUSI on column_y of target_table. The primary index defaults to column_x and no indexes are copied from subquery_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. target_table also takes the default definitions for all table options clause attributes.

    CREATE TABLE target_table AS (SELECT column_x, column_y
                                  FROM subquery_table)
    WITH NO DATA
    INDEX (column_y);