PRIMARY KEY - Advanced SQL Engine - Teradata Database

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
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™
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