Unique Keys

Unique keys can be set for any entity. Setting a unique key ensures that all attributes in the key form a group that contains entries which are unique.

Setting a Unique Key

To set a unique key, the user must first select the entity for which the key is to be enforced from either the canvas or the information tree. Right-clicking on the entity will produce a menu from which the user should select Add Unique Key. Once selected, the user will be prompted to enter a name for the unique key and select the attributes involved in the unique key.

To select an attribute, click on the attribute in the provided attribute list. If the key is to contain multiple attributes, shift-click all attributes until the desired selection is made.

Once attributes are selected, select Insert. The unique key will now be visible in the information tree. If the user has selected to show all attributes and unique keys, the unique key will also be visible on the canvas. Unique keys are distinguished from an attribute by its prefix. Attributes are displayed with a '@' prepended, whereas unique keys are displayed with a '$' prepended.

Editing a Unique Key

Editing a unique key occurs in a similar manner to adding a unique key. To edit a unique key, right-click on the key to be edited in the information tree. From the drop down menu, select Edit Unique Key. A dialog box will then be displayed prompting for the selection of the attributes to be involved in the key.

Once the selection is made, select Update. The unique key will now be updated.

Deleting a Unique Key

To delete a unique key, right-click on the unique key to be deleted. From the drop down menu, select Delete Unique Key. A dialog box will appear asking for confirmation of the delete. Once confirmed, the key will be deleted. Note that no associated attributes will be deleted by deleting a unique key.

Unique Keys and SQL Exportation

Because of the way that Easik performs exportation to SQL, unique keys are not permitted to be NOT NULL, as defined by SQL. For more information, see Exporting to SQL.