Column check constraints and table check constraints
You can specify check constraints associated with individual columns
(column check constraints), or with the entire table (table check
constraints). Both types of check constraint produce the same result
when the statement is issued, and you can specify any valid check
condition as either type. However, you might prefer to use table check
constraints for check conditions that would violate the SQL standard
(not enforced by Db2®) that a
column check constraint only refers to the column on which it is defined.
Note:
- If model table information is loaded into the Create Table utility, all check constraints defined on the table are loaded as table check constraints.
To specify column check constraints, use the Column Check Constraints panel.
The Column Check Constraints panel shows the columns defined for the table you are creating. If you have used the modeling facility, the panel shows the column details for each column in the model table.
To specify table check constraints, use the Table Check Constraints panel. Each row of the panel defines a single table check constraint.
You use the Table Check Constraints panel to specify an SQL check condition for each check constraint you want to define for the table you are creating.
Related references