Provide the size of the string in bytes.
| SELECT LENGTH(“SQL Tutorial”) AS LengthOfString; |
The LENGTH() function gives you the size of a string, measured in bytes.
| LENGTH(string) |
|
Parameter |
Description |
|
string |
Input required: The string for which to determine the length. |
| Works in: | From MySQL 4.0 |
Retrieve the byte length of the text in the “CustomerName” column.
| SELECT LENGTH(CustomerName) AS LengthOfName FROM Customers; |