15.10 - Example: NoPI Table CREATE Request That Converts PRIMARY KEY or UNIQUE Constraints to USIs - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
SQL_DDL_15_10.ditamap
dita:ditavalPath
ft:empty

If you create a NoPI table that also specifies a PRIMARY KEY, one or more UNIQUE constraints, or both, Teradata Database creates unique secondary indexes on the same column sets as the constraints.

Consider this CREATE TABLE request.

     CREATE TABLE nopi_constraints (
       column_1 INTEGER NOT NULL
       column_2 INTEGER NOT NULL 
     CONSTRAINT UNIQUE (column_1)
     CONSTRAINT PRIMARY KEY (column_2))
     NO PRIMARY INDEX;

For example, Teradata Database creates USIs for the two constraints because you have specified NO PRIMARY INDEX explicitly.

     CREATE TABLE nopi_constraints (
       column_1 INTEGER NOT NULL
       column_2 INTEGER NOT NULL)
     UNIQUE INDEX (column_1)
     UNIQUE INDEX (column_2)
     NO PRIMARY INDEX;