Home  >  Article  >  Database  >  What are the limitations of MySQL ENUM?

What are the limitations of MySQL ENUM?

PHPz
PHPzforward
2023-09-09 18:53:021080browse

MySQL ENUM 有哪些限制?

The following are the limitations of MySQL ENUM -

The enumeration value cannot be an expression

We cannot use an expression as Enumeration members, even expressions that evaluate to string values.

Example

For example, we can even use the CONCAT function which causes the string to be evaluated.

The following query will not work -

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

Cannot use user variables as enumeration members

Another limitation is that we cannot use user variables as Enumeration members Enumeration members. So 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'));

The above is the detailed content of What are the limitations of MySQL ENUM?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete