Constraints
Constraints provide a way to ensure the quality of the data in the database. This section describes the constraints supported in Exasol.
When using the database migration scripts, you can choose to comment out the generated constraints to prevent them from being executed when you run the output from the script.
Primary Keys
Primary keys are generated by the migration script. For example:
By default, primary key constraints generated by the migration script are enabled and checked during DML.
Example
The syntax to define a primary key in
-- Teradata Example
ALTER TABLE "ADVENTUREWORKSDW"."DIMACCOUNT" ADD CONSTRAINT PRIMARY KEY ("ACCOUNTKEY");
-- Exasol Example
ALTER TABLE "ADVENTUREWORKSDW"."DIMACCOUNT" ADD PRIMARY KEY ("ACCOUNTKEY");
Foreign Keys
Foreign keys are also generated by the migration script, but are left disabled. You can enable them later, after the creation of the foreign keys, if needed.
Example
The Syntax to define a foreign key in Exasol is similar to
ALTER TABLE "ADVENTUREWORKSDW"."DIMGEOGRAPHY" ADD FOREIGN KEY ("SALESTERRITORYKEY") REFERENCES "ADVENTUREWORKSDW"."DIMSALESTERRITORY" DISABLE;
Other Constraints
Constraints which are not supported in Exasol and cannot be migrated are:
- UNIQUE Constraints
- Column Constraints (CHECK Constraints)