length

Description

Syntax

‘INT length (VARCHAR str)’

Returns the length of the string and the number of characters returned for multi-byte characters. For example, five two-byte width words return a length of 10.

example

  1. mysql> select length("abc");
  2. +---------------+
  3. length ('abc') 1244;
  4. +---------------+
  5. | 3 |
  6. +---------------+
  7. mysql> select length("中国");
  8. +------------------+
  9. | length('中国') |
  10. +------------------+
  11. | 6 |
  12. +------------------+

keyword LENGTH