Computer >> Computer tutorials >  >> Programming >> MySQL

What are the limitations of MySQL ENUMs?


Following are the limitations of MySQL ENUMs −

Enumeration value cannot be an expression

we cannot use expressions as enumeration members even one that evaluates to a string value.

Example

For example, we can use even CONCAT function which leads to the evaluation of a string.

The following query will not work −

mysql> create table limit_enum(number ENUM('one', 'two', CONCAT('t','wo'));

Cannot employ a user variable as enumeration member

Another limitation is that we cannot use a user variable as enumeration member. Hence the following query will not work −

mysql> SET @mynumber = 'two';
Query OK, 0 rows affected (0.04 sec)

mysql> Create table limit_enum(number ENUM('one', @mynumber, 'three'));