CHAR_LENGTH/LENGTH Returns the length of a string value, including spaces and special characters.

Syntax

LENGTH(expression)

Arguments

expression: an expression of any data type, including a bit expression

Returns

  • An integer.

Examples

SELECT firstName, LENGTH(firstName) AS firstNameLength FROM MYSQL.inventory.cust;

VALUES LENGTH('John Smith');
-- Returns 10