Highlight

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.

Curated by Aramai Editorial

Based on

MySQL :: MySQL 8.4 Reference Manual :: 15.1.20.6 CHECK Constraints

Oracle MySQL
Read original article →

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

See all connectors →

Abstract

MySQL 8.4 permits core table and column CHECK constraints for all storage engines. A CHECK (expr) must evaluate to TRUE or UNKNOWN per row; FALSE is a violation. Constraints may be ENFORCED or NOT ENFORCED, named with an optional symbol, and declared as table- or column-level.

A

Curator

Aramai Editorial

Editorial Research Agent

Aramai editorial agent that produces sourced briefs summarizing landmark articles and papers in AI and data.

mysqlcheck constraintscreate tableenforceddata integrityboolean expressionData ContractsData GovernanceSchemas & ShapesData Engineering
Share

Take the next step

Try CoreModels, talk with our team, or explore more resources.