> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# VARCHAR

> VARCHAR(M)

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 `M` is \[1, 65533].
* From StarRocks 2.1 to 4.1, the value range of `M` is \[1, 1048576].
* From StarRocks 4.2 onwards, the value range of `M` is \[1, 2147482624] (2 GiB minus 1 KiB).

## Examples

Create a table and specify the column type as VARCHAR.

```SQL theme={null}
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)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.