Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

CHARACTER_LENGTH

Example

Provide the length of the string.

SELECT CHARACTER_LENGTH(“SQL Tutorial”AS LengthOfString; 

Definition and Usage

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

Note: This function is equivalent to the CHAR LENGTH() function.

Syntax

CHARACTER_LENGTH(string)

Parameter Values

Parameter

Description

string

Mandatory. Specifies the string for which the length is counted.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Retrieve the length of the text within the “CustomerName” column.

SELECT CHARACTER_LENGTH(CustomerName) AS LengthOfName
FROM Customers;