17.10 - PRIMARY KEY - 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)
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:
     PRIMARY KEY
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