ENUM
This page is part of MariaDB's Documentation.
The parent of this page is: Data Types for MariaDB Xpand
Topics on this page:
Overview
A single value from up to 65,535 pre-selected options.
USAGE
ENUM('<value_1>', '<value_2>', ...)
[{CHARACTER SET | CHARSET} <charset_name>]
[COLLATE <collation_name>]
DETAILS
Data Type | Minimum Number of Values | Maximum Number of Values |
---|---|---|
|
|
|
ENUM
values can contain spaces.
ENUM
columns can have a character set and collation.
EXAMPLES
Example of ENUM
:
CREATE TABLE enum_example (
description VARCHAR(20),
example ENUM('Alpha', 'Beta', 'Gamma', 'RC', 'Stable')
);
INSERT INTO enum_example VALUES
('foo', 'Beta'),
('bar', 'RC'),
('baz', 'Alpha'),
('bob', 5);
SELECT * FROM enum_example;
+-------------+---------+
| description | example |
+-------------+---------+
| foo | Beta |
| bar | RC |
| baz | Alpha |
| bob | Stable |
+-------------+---------+