Constraint Definition

An expression that defines a table constraint

Grammar syntax

constraint_specification:
  : [, PRIMARY KEY (col_name, ...) DISABLE NOVALIDATE RELY/NORELY ]
    [, CONSTRAINT constraint_name FOREIGN KEY (col_name, ...) REFERENCES table_name(col_name, ...) DISABLE NOVALIDATE 
    [, CONSTRAINT constraint_name UNIQUE (col_name, ...) DISABLE NOVALIDATE RELY/NORELY ]
    [, CONSTRAINT constraint_name CHECK [check_expression] ENABLE|DISABLE NOVALIDATE RELY/NORELY ]

Sample Source

1. Primary Key Table Constraint

The syntax is equivalent in both languages.

CREATE TABLE table1 (
    col1 integer,
    PRIMARY KEY (col1) DISABLE NOVALIDATE RELY
);

2. Foreign Key Table Constraint

The syntax is equivalent in both languages.

3. Unique Table Constraint

The syntax is equivalent in both languages.

4. Check Table Constraint

Sample Source

Known Issues

No issues were found.

  1. MSC-HVXXXX : THE CREATE TABLE CHECK CONSTRAINT IS NOT SUPPORTED IN SNOWFLAKE.

Last updated

Was this helpful?