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

# right

> 从字符串右侧返回指定长度的字符。

从字符串右边部分返回指定长度的字符，长度的单位为「utf8 字符」。函数别名为 [strright](/documents/cn/4.2/sql-reference/sql-functions/string-functions/strright.md)。

## 语法

```Haskell theme={null}
VARCHAR right(VARCHAR str, INT len)
```

## 参数说明

`str`: 待处理的字符串，支持的数据类型为 VARCHAR。

`len`: 要返回的字符长度，支持的数据类型为 INT。

## 返回值说明

返回值的数据类型为 VARCHAR。

## 示例

```Plain Text theme={null}
MySQL > select right("Hello starrocks",5);
+-------------------------+
| right('Hello starrocks', 5) |
+-------------------------+
| rocks                   |
+-------------------------+
```


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