SET Type
This page is part of MariaDB's Documentation.
The parent of this page is: Data Types for MariaDB Xpand
Topics on this page:
Overview
One or more comma-separated values from a set of up to 64 pre-selected options.
USAGE
SET('<value_1>', '<value_2>', ...)
[{CHARACTER SET | CHARSET} <charset_name>]
[COLLATE <collation_name>]
DETAILS
Data Type | Minimum Number of Values | Maximum Number of Values |
---|---|---|
|
|
|
SET
values can contain spaces.
SET
columns can have a character set and collation.
EXAMPLES
Example of SET
:
CREATE TABLE set_example (
description VARCHAR(20),
example SET('Foo', 'Bar', 'Baz', 'Bob')
);
INSERT INTO set_example VALUES
('1 val', 'Foo'),
('2 vals', 'Baz,Foo'),
('4 vals', 'Bob,Foo,Bar,Foo,Baz,Bob');
SELECT * FROM set_example;
+-------------+-----------------+
| description | example |
+-------------+-----------------+
| 1 val | Foo |
| 2 vals | Foo,Baz |
| 4 vals | Foo,Bar,Baz,Bob |
+-------------+-----------------+