| `STRING | | STRING` | Concatenate of two strings. See also CONCAT(). See notes. | ‘This in an ’ || ‘example’ => This in an example |
CONCAT(STRING [, STRING [, ...]]) | Concatenation of all the string arguments. See notes. | CONCAT('Hello', ' it', ' is me') => Hello it is me | | |
LOWER(STRING) | Converts the string to all lowercase | LOWER('Hello') => hello | | |
UPPER(STRING) | Converts the string to all uppercase | UPPER('Hello') => HELLO | | |
POSITION(sub_string IN STRING) | Return the first starting index of the specified substring within the string, or zero if it’s not present. Returns an INT | POSITION('o' IN 'Hello') => 5 | | |
SUBSTRING(STRING start_int [, count_int] [FROM start_int] [FOR count_int]) | Extracts the substring of string starting at the start_int position if that is specified, and stopping after count_int characters if that is specified. If start_int is not specified - default to 1. If count_int is not specified - default is until the end of the string. If start_int is less than 1, the difference (1 - start_int) is subtracted from count_int and the result starts from position 1 | SUBSTRING('123456789' FROM 4 FOR 4) => 4567
SUBSTRING('123456789' FOR 2) => 12
SUBSTRING('123456789' FROM 4) => 456789
SUBSTRING('123456789' FROM -1 FOR 4) => 12 | | |
SUBSTRING(STRING start\_int FOR count\_int) | Alias of SUBSTRING | SUBSTRING('My example', 3, 5) => exam | | |
| `TRIM( [LEADING | TRAILING | BOTH] [trim_chars] FROM STRING)` | Removes the trim_chars characters (a space by default) from the start or the end, or both sides of the string (BOTH is the default) | TRIM(LEADING 'xx' FROM 'xxhello') => hello
TRIM(FROM ' hello ') => hello (no spaces)
TRIM(BOTH 'xyz' FROM 'xthis_is_mezy') => this_is_me |
BTRIM(STRING [, trim_chars]) | Alias of TRIM with BOTH | BTRIM('this_is_mez', 'xz') => this_is_me | | |
LTRIM(STRING [, trim_chars]) | Alias of TRIM with LEADING | LTRIM('xthis_is_mex', 'x') => this_is_mex | | |
RTRIM(STRING [, trim_chars]) | Alias of TRIM with TRAILING | RTRIM('xthis_is_mex', 'x') => xthis_is_me | | |
LEFT(STRING, n_int) | Returns the first n_int characters in the string, or when n_int is negative, returns all but last n_int characters | LEFT('This is me', 8) => This is
LEFT('This is me', -8) => Th | | |
RIGHT(STRING, n_int) | Returns the last n_int characters in the string, or when n_int is negative, returns all but last n_int characters | RIGHT('This is me', 8) => is me
RIGHT('This is me', -8) => me | | |
LENGTH(STRING) | Returns the number of characters in the string. Returns an INT. See notes. | LENGTH('This is me') => 10 | | |
LPAD(STRING, length_int [, fill_string]) | Extends the string to length_int length by prepending the fill_string (a space by default). Returns an INT. See notes. | LPAD('Hello', 10, '-') => -----Hello
LPAD('Hello', 10) => Hello (5 spaces) | | |
RPAD(STRING, length_int [, fill_string]) | Extends the string to length_int length by appending the fill_string (a space by default). See notes. | RPAD('Hello', 10, '-') => Hello----- | | |
REPEAT(STRING, n_int) | Repeats string the specified n_int times | REPEAT('Hello', 3) => Hello_Hello_Hello | | |
REPLACE(STRING, from_text, to_text) | Replaces all occurrences in string of substring from_text with substring to_text | REPLACE('Hello this is me', 'me', 'you') => Hello this is you | | |
REVERSE(STRING) | Reverses the order of the characters in the string | REVERSE('Hello') => olleH | | |
string [NOT] LIKE pattern [ESCAPE escape-char] | Matches (or not) string expressions by patterns. The match is case sensitive. Returns BOOLEAN. See notes. | 'This is me' LIKE 'This%' => true
'This is me' LIKE '%is%' => true
'20% discount' LIKE '20!%' ESCAPE '!' => true | | |