[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ENUM
and SET
In MySQL 4.x, ENUM
is not a real constraint, but is a more efficient
way to define columns that can only contain a given set of values.
This is because of the same reasons NOT NULL
is not honored.
See section 1.8.6.2 Constraint NOT NULL
and DEFAULT
values.
If you insert an incorrect value into an ENUM
column, it will be set to
the reserved enumeration value 0
, which will be displayed as an empty
string in string context. See section 11.3.3 The ENUM
Type.
If you insert an incorrect value into a SET
column, the incorrect value
is ignored. For example, if the column can contain the values
'a'
, 'b'
, and 'c'
, an attempt to assign 'a,x,b,y'
results in a value of 'a,b'
.
See section 11.3.4 The SET
Type.