Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functions-and-operators: enrich instructions for string functions CHAR_LENGTH() and CHARACTER_LENGTH #15483 #16057

Merged
Merged
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions functions-and-operators/string-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,38 @@ Return the character for each integer passed.

### [`CHAR_LENGTH()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char-length)

Return number of characters in argument.
The `CHAR_LENGTH()` function is used to get the total number of characters in a given argument as an integer.

Examples:

```sql
SELECT CHAR_LENGTH("TiDB") AS LengthOfString;

+----------------+
| LengthOfString |
+----------------+
| 4 |
+----------------+
```

```sql
SELECT CustomerName, CHAR_LENGTH(CustomerName) AS LenghtOfName FROM Customers;

+--------------------+--------------+
| CustomerName | LenghtOfName |
+--------------------+--------------+
| Albert Einstein | 15 |
| Robert Oppenheimer | 18 |
+--------------------+--------------+
```
PitifulPete marked this conversation as resolved.
Show resolved Hide resolved

> **Note:**
>
> The preceding example operates under the assumption that there is a database with a table named `Customers` and a column inside the table named `CustomerName`.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

### [`CHARACTER_LENGTH()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_character-length)

Synonym for `CHAR_LENGTH()`.
The `CHARACTER_LENGTH()` function is the same as the `CHAR_LENGTH()` function. Both functions can be used synonymously because they provide the same outputs.
qiancai marked this conversation as resolved.
Show resolved Hide resolved

### [`CONCAT()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_concat)

Expand Down
Loading