CHECK constraints
The CHECK constraint accepts a range of values allowed for a specific column. A simple CHECK constraint can be built using multiple comparison operators such as >, <, >=, <=, =, and <>. A complex CHECK constraint can also be built using AND, OR, NOT (Boolean operators), and LIKE (using wildcard characters such as % and _) or IN predicates.
The CHECK constraints are evaluated to return a value of TRUE or FALSE. The value that passes the CHECK constraint is inserted or updated into the table. The value that does not pass the CHECK constraint is rejected and SQL error SQL0545N is returned to the application.
The following diagram shows how to use the CHECK constraint to control what data values are allowed by a column or set ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access