17.05 - Example: CREATE … AS Requests That Produce a Table With a Primary Index - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
mdr1472255012272

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);