15.10 - UNIQUE - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

An unnamed UNIQUE constraint on a single column or a composite UNIQUE constraint on multiple columns of the table. A UNIQUE constraint enforces the rule that no two rows in the table can have the same value in a column set. 
Columns must be defined as NOT NULL.
Any system-defined secondary or single-table join indexes used for this constraint are included in the maximum of 32 secondary, hash, and join indexes per table. This includes the system-defined secondary indexes used to implement UNIQUE constraints for nontemporal tables and the single-table join indexes used for UNIQUE constraints on temporal tables.
A UNIQUE constraint is a unique secondary index for nontemporal tables and a single-table join index for most temporal tables.
UNIQUE constraints ensure the uniqueness of alternate keys. Columns with UNIQUE constraints can be used to create referential integrity relationships with other tables. For details about UNIQUE constraints on temporal tables, see ANSI Temporal Table Support, B035-1186 and Temporal Table Support, B035-1182.
You cannot specify UNIQUE constraints on columns with the following data types.

  • BLOB
  • CLOB
  • ARRAY
  • VARRAY
  • JSON
  • XML
  • Period
  • Geospatial

If the current data violates the uniqueness constraint, the system returns an error to the requestor and the table is not changed.

CONSTRAINT constraint_name
A named UNIQUE column constraint.