Use the Domain dialog to define a domain. A domain is a data type definition that may constrain permissible values. Domains are useful when you are creating multiple tables that contain comparable columns; you can create a domain that defines constraints that are common to the columns and re-use the domain definition when creating the columns, rather than individually defining each set of constraints.
The Domain dialog organizes the development of a domain through the following tabs: General, Definition, Constraints, and Security. The SQL tab displays the SQL code generated by dialog selections.
Use the fields on the General tab to identify a domain:
Click the Definition tab to continue.
Use the fields in the Definition tab to describe the domain:
Click the Constraints tab to continue.
Use the fields in the Constraints tab to specify rules for the domain. Click the Add icon (+) to set constraints:
A CHECK clause specifies an integrity test which values of the domain must satisfy. Each constraint must be an expression that produces a Boolean result. Use the key word VALUE to refer to the value being tested. Expressions evaluating to TRUE or UNKNOWN succeed. If the expression produces a FALSE result, an error is reported and the value is not allowed to be converted to the domain type. A CHECK expression cannot contain subqueries nor refer to variables other than VALUE. If a domain has multiple CHECK constraints, they will be tested in alphabetical order by name.
Click the Add icon (+) to set additional constraints; to discard a constraint, click the trash icon to the left of the row and confirm deletion in the Delete Row popup.
Click the Security tab to continue.
Use the Security Labels panel to assign security labels. Click the Add icon (+) to add a label:
Click the Add icon (+) to specify each additional label; to discard a label, click the trash icon to the left of the row and confirm deletion in the Delete Row popup.
Click the SQL tab to continue.
Your entries in the Domain dialog generate a SQL command (see an example below). Use the SQL tab for review; revisit or switch tabs to make any changes to the SQL command.
Example
The following is an example of the sql command generated by selections made in the Domain dialog:
The example shown demonstrates creating a domain named minimum-wage that confirms that the value entered is greater than or equal to 7.25.