MySQL CHECK constraints encode boolean row rules with optional enforcement
MySQL :: MySQL 8.4 Reference Manual :: 15.1.20.6 CHECK Constraints
MySQL 8.4 reference for CREATE TABLE CHECK constraints: naming, boolean expr, ENFORCED/NOT ENFORCED, table vs column form.
Based on
MySQL :: MySQL 8.4 Reference Manual :: 15.1.20.6 CHECK Constraints
The MySQL 8.4 manual section covers CHECK constraints on CREATE TABLE. Syntax is [CONSTRAINT [symbol]] CHECK (expr) [[NOT] ENFORCED]. expr is a boolean that must be TRUE or UNKNOWN; FALSE fails. Omitted names become table_chk_N; names are case-sensitive up to 64 characters. Table constraints may reference any columns; column constraints are limited to that column’s definition context as described in the extract.
For data engineering and governance, CHECK moves a slice of the data contract into the engine. Teams can stage rules as NOT ENFORCED then flip to ENFORCED, which is useful when aligning warehouse and OLTP rules with documented meaning.
Governed semantic models often need database-native enforcement of cardinality-like or value rules that shapes describe at a higher layer. CHECK is one place those rules become executable beside the table definition, reducing drift between documented meaning and stored rows.
Violation behavior depends on the statement being executed, so application and sync layers must account for how failed checks surface—not only that the constraint exists.
Put this to work on CoreModels
Related connectors and recipes
See all connectors →Take the next step
Try CoreModels, talk with our team, or explore more resources.