Home > Database > Mysql Tutorial > What are the limitations of MySQL ENUM?

What are the limitations of MySQL ENUM?

PHPz
Release: 2023-09-09 18:53:02
forward
1173 people have browsed it

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'));
Copy after login

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'));
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template