# text

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: text
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-data-types/text
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-data-types/text.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-data-types/text.adoc
description: The text data type is a UTF8-encoded text with Unicode support, which stores a sequence of characters (text).
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-data-types/text.md -->

The text data type is a UTF8-encoded text with Unicode support, which stores a sequence of characters (text).

## [](#examples)Examples

Create an employee table with a text data type in each column:

```sql
CREATE TABLE employee (
    employeeName text,
    employeeDept text,
    employeeRole text
);
INSERT INTO employee (employeeName, employeeDept, employeeRole)
VALUES ('John','Finance','Staff'),
       ('Maya','Product','Staff'),
       ('Jane','Finance','Staff'),
       ('Phil','HR','Manager');
```

> 💡 **TIP**
>
> Insert the text value between the single quotes `' '`.

The following output shows the created table:

```sql
+---------------+---------------+---------------+
| employeename  | employeedept  | employeerole  |
+---------------+---------------+---------------+
| John          | Finance       | Staff         |
| Maya          | Product       | Staff         |
| Jane          | Finance       | Staff         |
| Phil          | HR            | Manager       |
+---------------+---------------+---------------+
```

## [](#text-with-substr-function)Text with SUBSTR function

The `SUBSTR` function extracts a specific number of characters from a text.

### [](#syntax)Syntax

```sql
substr( text, start_position, length )
```

The syntax includes the following parameters:

-   `text` is the specified text.

-   `start_position` is the starting position, specifying the part from which the substring is returned. Use an integer value.

-   `length` determines the number of characters to extract. Use one or more characters.


> 📝 **NOTE**
>
> The first position in the `text` is 1.

### [](#example)Example

Insert a value into the text column.

```sql
SELECT substr('Watermelon',6,5) AS "Fruit";
```

The following output shows the result:

```sql
+-------------+
| Fruit       |
+-------------+
| melon       |
+-------------+
```

## [](#text-with-length-function)Text with LENGTH function

The `length()` function returns the number of characters in a text.

> 📝 **NOTE**
>
> The number of characters might be different from the byte length.

### [](#syntax-2)Syntax

The length function will take a text as a parameter.

```sql
LENGTH (text);
```

### [](#example-2)Example

Insert a value into the text column.

```sql
SELECT LENGTH ('UNITED STATES');
```

The following output shows the result.

```sql
+---------+
| f       |
+---------+
| 13      |
+---------+
```

> 📝 **NOTE**
>
> The `length()` function will also count spaces.