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

# CHAR

> CHAR(M) 是定长字符串类型，M 的范围为 [1, 255] 字节。

## 描述

CHAR(M)

定长字符串，`M` 代表的是定长字符串的长度。单位：字节。`M` 的范围是 \[1, 255]。

## 示例

创建表时指定字段类型为 CHAR。

```sql theme={null}
CREATE TABLE charDemo (
    pk INT COMMENT "range [-2147483648, 2147483647]",
    pd_type CHAR(20) NOT NULL COMMENT "range char(m),m in (1-255) "
) 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.