Example: CREATE TABLE AS Requests that Create Table with Primary Index - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Assume that you define the following primary-indexed table.

     CREATE TABLE source (
       column_1 INTEGER
       column_2 INTEGER)
     UNIQUE PRIMARY INDEX (column_1);

The following CREATE TABLE AS requests both produce primary-indexed tables; however, the second creates the table with a nonunique primary index.

     CREATE TABLE target
     AS source
     WITH NO DATA;

     CREATE TABLE target AS (SELECT column_1, column_2
                             FROM source)
     WITH DATA 
     PRIMARY INDEX (column_1);