Copying Table Definitions - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

The AS clause copies definitions for an existing table or query expression to a new table.

The following table describes the various AS options.

Use this option … To copy from an existing source table or query expression to a new target table …
AS …WITH NO DATA the specified column definitions only.
AS … WITH DATA the specified column definitions and the data associated with those columns.

Note that you cannot create a global temporary table using the WITH DATA option.

AS … WITH NO DATA AND STATISTICS the specified column definitions and their statistical histograms.

Data is not copied.

AS … WITH DATA AND STATISTICS the specified column definitions and their statistical histograms.

Data is copied.

Use count information is copied when USECOUNT is enabled for the target database. See BEGIN QUERY LOGGING.

To copy only a subset of the source table and, optionally, its statistics, specify a subquery that selects only those columns desired in the target table. You can also use the subquery option to specify column expressions based on columns in the existing table to define column modifications for the target table. See Using Subqueries To Customize An AS Clause for further information.