Example: Adding a NORMALIZE Constraint to a Table - 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
Publication Date
June 2022
Content Type
SQL Reference
Publication ID
B035-1144-172K
ft:locale
en-US
ft:lastEdition
2025-11-22
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
ft:sourceId
dita
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

These examples show how to use an ALTER TABLE request to add a NORMALIZE constraint to a table. The system default condition for a NORMALIZE constraint is:

  ON MEETS OR OVERLAPS

The examples all use the following table definition or an equivalent temporal table definition. The table definition does not specify a NORMALIZE constraint.

     CREATE TABLE project (
       emp_id       INTEGER,
       project_name VARCHAR(20),
       dept_id      INTEGER,
       duration     PERIOD(DATE));

The following ALTER TABLE request modifies the project table to add a NORMALIZE constraint on the duration column. Rows are normalized only when the values of the emp_id, project_name, and dept_id columns are the same and the Period values for the duration column either meet or overlap.

     ALTER TABLE project 
     ADD NORMALIZE ON duration;

The following ALTER TABLE request modifies the project table to add a NORMALIZE constraint on the duration column. The dept_id column is the only column to ignore for normalization.

Rows are normalized only when the values of columns emp_id and project_name are the same and the Period values for the duration column meet or overlap.

     ALTER TABLE project 
     ADD NORMALIZE ALL BUT(dept_id) ON duration;

The following ALTER TABLE request modifies the project table to add a NORMALIZE constraint on the duration column that applies only when the Period values for the duration column overlap. The dept_id column is the only column to ignore for normalization.

Rows are normalized only when the values of columns emp_id and project_name are the same and the Period values for the duration column overlap.

     ALTER TABLE project 
     ADD NORMALIZE ALL BUT(dept_id) ON duration ON OVERLAPS;

The following ALTER TABLE request modifies the project table to add a NORMALIZE constraint on the duration column that applies only when the Period values for the duration column overlap. The dept_id column is the only column to ignore for normalization.

Rows are normalized only when the values of columns emp_id and project_name are the same and the Period values for the duration column overlap.

     ALTER TABLE project 
     ADD NORMALIZE ALL BUT(dept_id) ON duration ON OVERLAPS;

The next example defines the project table using a NORMALIZE condition of ON OVERLAPS on the duration column.

     CREATE TABLE project (
       emp_id INTEGER,
       project_name VARCHAR(20),
       dept_id INTEGER,
       duration PERIOD(DATE),
     NORMALIZE ALL BUT (dept_id) ON duration ON OVERLAPS);

Modify the definition of project to add the project_name column to the ALL BUT normalize_ignore column list and to add the condition OR MEETS to the existing ON OVERLAPS condition.

     ALTER TABLE
     ADD NORMALIZE ALL BUT(dept_id,project_name) ON duration ON OVERLAPS
      OR MEETS;

Vantage renormalizes the project table after you submit this ALTER TABLE request.