17.10 - Example: NoPI Table CREATE Request That Converts PRIMARY KEY or UNIQUE Constraints to USIs - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

If you create a NoPI table that also specifies a PRIMARY KEY, one or more UNIQUE constraints, or both, Vantage 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, Vantage 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;