October 2002
Beginner
864 pages
18h 41m
English
This section lists the syntax and examples of MySQL character functions. These functions will be used in the Workshop. Note similarities and differences to ANSI syntax as previously shown in this chapter. MySQL character functions are listed in addition to ANSI SQL functions because character functions tend to vary widely between SQL implementations.
LENGTH(str) returns the length of the string str.
mysql> select LENGTH('text');
-> 4
mysql> select OCTET_LENGTH('text');
-> 4
Note that for CHAR_LENGTH(), multibyte characters are only counted once.
LOCATE(substr,str) returns the position of the first occurrence of substring substr in string str. It returns 0 if substr is not in ...
Read now
Unlock full access