bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL CHAR_LENGTH() Function

Concept visual

MySQL CHAR_LENGTH() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the length of the string:

SELECT CHAR_LENGTH("SQL Tutorial") AS LengthOfString;

Definition and Usage

The CHAR_LENGTH() function return the length of a string (in characters).

Note:

This function is equal to the

CHARACTER_LENGTH() function.

Syntax

CHAR_LENGTH( string )

Parameter Values

Parameter

Description string

Required. The string to count the length for

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return the length of the text in the "CustomerName" column:

SELECT CHAR_LENGTH(CustomerName) AS LengthOfName
FROM Customers;

Previous

❮ MySQL Functions

Next

Previous

MySQL ASCII() Function

Next

MySQL CHARACTER_LENGTH() Function