MySQL CHARACTER_LENGTH() Function

Example

Return the length of the string:

SELECT CHARACTER_LENGTH("SQL Tutorial"AS LengthOfString;

-


Definition and Usage

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

Note: This function is equal to the CHAR_LENGTH() function.

Syntax

CHARACTER_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 CHARACTER_LENGTH(CustomerName) AS LengthOfName
FROM Customers;

-

 


Login
ADS CODE