Provide the length of the string.
| SELECT CHAR_LENGTH(“SQL Tutorial”) AS LengthOfString; |
The CHAR_LENGTH() function retrieves the length of a string in characters.
Note: This function is equivalent to the CHARACTER_LENGTH() function.
| CHAR_LENGTH(string) |
|
Parameter |
Description |
|
string |
Mandatory. Specifies the string for which to determine the length. |
| Works in: | From MySQL 4.0 |
Retrieve the length of the text within the “CustomerName” column.
| SELECT CHAR_LENGTH(CustomerName) AS LengthOfName FROM Customers; |