Name

LENGTH()

Synopsis

LENGTH(str)

Returns the length in bytes of the string str. Note that multibyte characters count as multiple bytes. If you need to know the actual number of characters in a string use the CHAR_LENGTH function. This code returns the value 10:

SELECT LENGTH('Tony Blair');

Get Learning PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.