> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/data-types/string-data-types/set-data-type.md).

# SET Data Type

## Syntax

```bnf
SET('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]
```

## Description

A set. A string object that can have zero or more values, each of which must be chosen from the list of values 'value1', 'value2', ... A `SET` column can have a maximum of 64 members. `SET` values are\
represented internally as integers.

`SET` values cannot contain commas.

If a `SET` contains duplicate values, an error will be returned if [strict mode](/docs/server/server-management/variables-and-modes/sql_mode.md#strict-mode) is enabled, or a warning if strict mode is not enabled.

## EXAMPLES

```sql
CREATE TABLE set_example (
  description VARCHAR(20),
  example SET('Foo', 'Bar', 'Baz', 'Bob')
);
```

```sql
INSERT INTO set_example VALUES
  ('1 val', 'Foo'),
  ('2 vals', 'Baz,Foo'),
  ('4 vals', 'Bob,Foo,Bar,Foo,Baz,Bob');
```

```sql
SELECT * FROM set_example;

+-------------+-----------------+
| description | example         |
+-------------+-----------------+
| 1 val       | Foo             |
| 2 vals      | Foo,Baz         |
| 4 vals      | Foo,Bar,Baz,Bob |
+-------------+-----------------+
```

## See Also

* [Character Sets and Collations](/docs/server/reference/data-types/string-data-types/character-sets/supported-character-sets-and-collations.md)
* [Data Type Storage Requirements](/docs/server/reference/data-types/data-type-storage-requirements.md)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
