SET Data Type
String object with zero or more values from a predefined list. A SET column can store multiple values selected from a list of permitted strings.
Syntax
SET('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]Description
EXAMPLES
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 |
+-------------+-----------------+See Also
Last updated
Was this helpful?

