17.00 - PRIMARY KEY - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Advanced SQL Engine
Teradata Database
Release Number
September 2020
Content Type
Programming Reference
Publication ID
English (United States)
Last Update
The column as the primary key for the table. The column must be defined as NOT NULL. For an unnamed PRIMARY KEY column constraint, use this syntax:
Use the column attribute form of PRIMARY KEY when the constraint applies only to the column and the primary key for the table is defined only on the single column. Tables can have only one primary key. To specify primary keys for referential integrity relationships with other tables, alter the column to have a UNIQUE constraint. Any system-defined secondary or single-table join indexes used to implement this constraint are included in the maximum of 32 secondary, hash, and join indexes per table. A PRIMARY KEY constraint is a unique secondary index or UPI for nontemporal tables and a single-table join index for most temporal tables. For details and examples of PRIMARY KEY constraint on temporal tables, see Teradata Vantage™ - Temporal Table Support , B035-1182 .

You cannot include a column with the JSON data type in a PRIMARY KEY.

You cannot add a PRIMARY KEY constraint on a row-level security constraint column.

CONSTRAINT constraint_name
For a named PRIMARY KEY column constraint, use this syntax:
     CONSTRAINT constraint_name PRIMARY KEY