OceanBase AI Database supports the set data type SET. A SET is a string object that can have zero or more values, each of which must come from the list 'value1', 'value2', ....
SET is a variable-length type that supports the UTF8MB4 character set.
The syntax for SET is as follows:
SET('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]
SET values are internally represented as integers. A SET column can define up to 64 elements, with each element being at most 255 characters long. Values in a SET column composed of multiple set elements are separated by commas (,).
For example, the column of SET('a', 'b') NOT NULL can have the following values:
' '
'a'
'b'
'a,b'
CHARACTER SET specifies the character set. If necessary, you can use the COLLATE attribute and other attributes to specify the collation for the character set.
SET values are stored numerically, with the least significant bit corresponding to the first set element. SET values are sorted numerically. NULL values precede non-NULL values. If strict SQL mode is enabled, defining duplicate values will result in a warning or error. When creating a table, trailing spaces are automatically removed from the SET member values in the table definition.