CREATE TABLE Statement [CONSTRAINT [ symbol ]] CHECK ( expr ) [[NOT] ENFORCED] The optional  symbol  specifies a name for the constraint. If omitted, MySQL generates a name from the table name, a literal  _chk_ , and an ordinal number (1, 2, 3, ...). Constraint names have a maximum length of 64 characters. They are case-sensitive, but not accent-sensitive. expr  specifies the constraint condition as a boolean expression that must evaluate to  TRUE  or  UNKNOWN (for  NULL  values) for each row of the table. If the condition evaluates to  FALSE , it fails and a constraint violation occurs. The effect of a violation depends on the statement being executed, as described later in this section. The optional enforcement clause indicates whether the constraint is enforced: •If omitted or specified as  ENFORCED , the constraint is created and enforced. •If specified as  NOT ENFORCED , the constraint is created but not enforced. •A table constraint does not appear within a column definition and can refer to any table column or columns. Forward references are permitted to columns appearing later in the table definition. •A column constraint appears within a column definition and can refer only to that column. A  CHECK  constraint is specified as either a table constraint or column constraint: Consider this table definition: CREATE TABLE t1 ( CHECK (c1 <> c2), c1 INT CHECK (c1 > 10), c2 INT CONSTRAINT c2_positive CHECK (c2 > 0), c3 INT CHECK (c3 < 100), CONSTRAINT c1_nonzero CHECK (c1 <> 0), CHECK (c1 > c3) ); The definition includes table constraints and column constraints, in named and unnamed formats: •The first constraint is a table constraint: It occurs outside any column definition, so it can (and does) refer to multiple table columns. This constraint contains forward references to columns not defined yet. No constraint name is specified, so MySQL generates a name. •The next three constraints are column constraints: Each occurs within a column definition, and thus can refer only to the column being defined. One of the constraints is named explicitly. MySQL generates a name for each of the other two. •The last two constraints are table constraints. One of them is named explicitly. MySQL generates a name for the other one. As mentioned, MySQL generates a name for any  CHECK  constraint specified without one. To see the names generated for the preceding table definition, use  SHOW CREATE TABLE : mysql>  SHOW CREATE TABLE t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE ‘t1‘ ( ‘c1‘ int(11) DEFAULT NULL, ‘c2‘ int(11) DEFAULT NULL, ‘c3‘ int(11) DEFAULT NULL, CONSTRAINT ‘c1_nonzero‘ CHECK ((‘c1‘ <> 0)), CONSTRAINT ‘c2_positive‘ CHECK ((‘c2‘ > 0)), 2582