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.
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));