Login logout

The Constraints on a table.
Figure 1


ER-Designer supports Primary Key (PK), Foreign Key (FK), Unique, and Checked constraints. The screen snap shot of the Entity Editors' Constraint tab shows the sub-tabs for each of the constraint types.

Each constraint sub-tab has a summary of the specific type of constraint on the table. In most cases on most DBMS's' there can multiple constraint of the same type. Of course there can be any combination of constraints too.

The Primary Key (PK) constraint can be set my the user. In many cases just tagging an attribute as a primary key (and in the case of SQLite with the identity property) will automatically generate an implied primary key constraint.

The Foreign Key (FK) constraints are automatically generated by the existence of a relationship. This can be edited and deleted by the user. The FK constraint can not be created in the entity editor, as it requires implicit knowledge of the parent entity.

The Constraint Editor.
Figure 2

The check constraint is the architect and/or developers sanity. They can add what every checks of the data they want. This is on of the cases that may be difficult to merge back into the logical model.

The unique constraint is where the DBMS can make sure that any particular combination of columns is unique in the table. Normally this is done with and index (aka key) on the particular column combination.

The screen shot below shows the Add Unique Constraint editor. The conflict resolution (what to do when the constraint predicate fails) can be selected in the editor. This same system in all the constraint editors.