Skip to content

LENGTH

  • str: The string argument for which the length is to be returned. The function LENGTH(str) returns the length of the string str in bytes.
SELECT LENGTH('SQL Documentation') AS String_Length;
+----------------+
| String_Length |
+----------------+
| 17|
+----------------+

The LENGTH function in MySQL is used to retrieve the length of a string. In this example, it is applied to the string ‘SQL Documentation’, returning 17, which represents the number of characters (including spaces) in this string.