PRIMARY KEY Constraints - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

The primary key of a table is a column set that uniquely identifies each row of that table. See Teradata Vantage™ - Database Design, B035-1094. You cannot define more than 1 primary key for a table. Primary keys, which are a logical construct in the relational model, are usually implemented physically as the unique primary index.

To create a composite, or multicolumn, primary key for a table, you must specify the PRIMARY KEY constraint at the table level, not the column level.

Columns defined with a data type from the following list cannot be a component of a PRIMARY KEY constraint.
  • BLOB
  • CLOB
  • BLOB-based UDT
  • CLOB-based UDT
  • ARRAY
  • VARRAY
  • Period
  • Geospatial

When a table has a nonunique primary index, you should consider defining its primary key explicitly using the PRIMARY KEY clause. Primary and other alternate keys are also used with foreign keys to enforce referential integrity relationships between tables (see Standard Referential Integrity Constraints, Batch Referential Integrity Constraints, and Referential Constraints).