CHECK Constraint Column Attribute - Teradata Vantage - Analytics Database

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-22
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

An optionally named simple boolean conditional expression used to constrain the values that can be inserted into, or updated for, a column.

A column attribute CHECK constraint cannot reference other columns in the same table or another table.

When you specify multiple CHECK constraints on a single column:

  • Multiple unnamed column-level CHECK constraints are combined into a single column-level CHECK constraint.
  • Multiple named column-level CHECK constraints are processed individually.

You can specify column-level CHECK constraints for nontemporal and temporal tables. See Teradata Vantage™ - ANSI Temporal Table Support, B035-1186 and Teradata Vantage™ - Temporal Table Support, B035-1182.

CHECK (boolean_condition)
The boolean_condition must reference a column_name.
For an unnamed CHECK column constraint, use this syntax:
     CHECK (boolean_condition)
CONSTRAINT constraint_name
For a named CHECK column constraint, use this syntax:
     CONSTRAINT constraint_name CHECK (boolean_condition)

Example: Specifying a Mix of Column-Level and Table-Level Named and Unnamed CHECK Constraints

The request in this example combines the three unnamed CHECKs for column_1. Constraint check_0 and each of the named CHECKs for column_2 are treated as table constraints.

    CREATE TABLE good_4 (
      column_1 INTEGER
        CHECK (column_1 > 0)
        CHECK (column_1 < 999)
        CHECK (column_1 NOT IN (100,200,300))
       CONSTRAINT check_0
        CHECK (column_1 IS NOT NULL),
      column_2 INTEGER
       CONSTRAINT check_1
        CHECK (column_2 > 0)
        CHECK (column_2 < 999));