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 Constraint Options
Constraint type | Select the constraint type. |
Fields | Choose the constrained fields / columns (for PRIMARY KEY and UNIQUE constraints). |
Expression | Specify expression (for CHECK constraint). |
Enabled | Specify either the constraint is enabled (for Oracle database). |
Deferrable | Specify either the constraint is deferrable (for Oracle and PostgreSQL databases). |
Deferred | Specify either the deferrable constraint is initially deferred (for Oracle and PostgreSQL databases). |
Action | Specify 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
- Working with table constraints through the interface is currently supported only for Oracle, PostgreSQL, SQL Server, Firebird, Interbase, MySQL databases.
- 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