VARCHAR
VARCHAR(M)
A variable-length string. M indicates the length of the string. The default value is 1. Unit: bytes.
- In versions earlier than StarRocks 2.1, the value range of
Mis [1, 65533]. - From StarRocks 2.1 to 4.1, the value range of
Mis [1, 1048576]. - From StarRocks 4.2 onwards, the value range of
Mis [1, 2147482624] (2 GiB minus 1 KiB).
Examples
Create a table and specify the column type as VARCHAR.
CREATE TABLE varcharDemo (
pk INT COMMENT "range [-2147483648, 2147483647]",
pd_type VARCHAR(20) COMMENT "variable-length string"
) ENGINE=OLAP
DUPLICATE KEY(pk)
COMMENT "OLAP"
DISTRIBUTED BY HASH(pk)