Creating Constraint from GUI

To add a constraint to a table, open that table, switch to the Constraints page of the Table window, and click Add button.

Creating a table constraint in Database Tour

Creating Constraint Options

Constraint typeSelect the constraint type.
FieldsChoose the constrained fields / columns (for PRIMARY KEY and UNIQUE constraints).
ExpressionSpecify expression (for CHECK constraint).
EnabledSpecify either the constraint is enabled (for Oracle database).
DeferrableSpecify either the constraint is deferrable (for Oracle and PostgreSQL databases).
DeferredSpecify either the deferrable constraint is initially deferred (for Oracle and PostgreSQL databases).
ActionSpecify either to add the constraint immediately or generate SQL code instead. In latter case, you are able to modify the generated SQL code before applying the command.

Notes

  1. Working with table constraints through the interface is currently supported only for Oracle, PostgreSQL, SQL Server, Firebird, Interbase, MySQL databases.
  2. Working with foreign keys constraints is available on the Foreign Keys page of the Table window.

Creating Constraint by SQL

Advanced users can also create a constraint by executing SQL query like this (read your database documentation for details):

ALTER TABLE detail.employee ADD CONSTRAINT employee_login_key UNIQUE (login)

See also

 Adding or Modifying Table Field

 Adding Table Index

 Adding Table Foreign Key

 Adding Table Partition

 Viewing and Editing Table Structure