Example: AS … WITH NO DATA With Named Expressions - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

This CREATE TABLE … AS … WITH NO DATA request creates target_table from a subquery where all column expressions are named explicitly. No column names are defined for target_table because it is unnecessary.

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 column_x + 1 AS column_x,
                                          column_y + 1 AS column_y
                                   FROM subquery_table )
     WITH NO DATA;