---

slug: /set-type
---

# Set type

seekdb supports the `SET` type. `SET` is a string object that can have zero or more values, each of which must be one of the values in the list `'value1', 'value2', ...'`.

`SET` is a variable-length type that supports the `UTF8MB4` character set.

The syntax for `SET` is as follows:

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

Internally, `SET` values are represented as integers. A `SET` column can have a maximum of 64 elements, each of which can be up to 255 characters long. The values of a `SET` column with multiple elements are separated by commas (,).

For example, a column defined as `SET('a', 'b') NOT NULL` can have the following values:

```sql
' '
'a'
'b'
'a,b'
```

The `CHARACTER SET` clause specifies the character set. You can use the `COLLATE` attribute and other attributes to specify the collation of the character set, if needed.

`SET` values are stored as numbers, with the least significant bit corresponding to the first element in the set. `SET` values are sorted numerically. `NULL` values are sorted before non-`NULL` values. If strict SQL mode is enabled, defining duplicate values generates a warning or error. When creating a table, trailing spaces are automatically removed from `SET` member values in the table definition.