1
1
String Functions and Operators
2
==============================
6
========== ===========================================
8
========== ===========================================
9
LIKE Simple pattern matching
10
NOT LIKE Negation of simple pattern matching
11
STRCMP() Compare two strings
12
========== ===========================================
16
=================== =============================================================================================================
2
===============================
15
List of string operators and descriptions by type of function:
18
Comparative and regular functions
19
---------------------------------
21
=================== ====================================================================================================
23
=================== ====================================================================================================
24
LIKE Returns values that match a simple pattern
25
NOT LIKE Negation of simple pattern matching
26
STRCMP() Compare two strings
17
27
NOT REGEXP Negation of REGEXP
18
REGEXP Pattern matching using regular expressions
28
REGEXP Returns values that match a regular expression pattern
19
29
RLIKE Synonym for REGEXP
20
=================== =============================================================================================================
23
Other string functions:
25
=================== =============================================================================================================
30
=================== ====================================================================================================
33
Conversion and translation functions
34
------------------------------------
35
=================== ====================================================================================================
37
=================== ====================================================================================================
26
38
ASCII() Return numeric value of left-most character
27
39
BIN() Return a string representation of the argument
40
CHAR() Return the character for each integer passed
41
HEX() Return a hexadecimal representation of a decimal or string value
42
LOWER() Return the argument in lowercase
43
LCASE() Synonym for LOWER()
44
UCASE() Synonym for UPPER()
45
UNHEX() Convert each pair of hexadecimal digits to a character
46
UPPER() Convert to uppercase
47
=================== ====================================================================================================
50
Length and size functions
51
-------------------------
52
=================== ====================================================================================================
54
=================== ====================================================================================================
28
55
BIT_LENGTH() Return length of argument in bits
29
56
CHAR_LENGTH() Return number of characters in argument
30
CHAR() Return the character for each integer passed
31
CHARACTER_LENGTH() A synonym for CHAR_LENGTH()
32
CONCAT() Return concatenated string
33
ELT() Return string at index number
34
EXPORT_SET() Return a string such that for every bit set in the value bits, you get an on string and for every unset bit, you get an off string
57
LENGTH() Return the length of a string in bytes
58
OCTET_LENGTH() A synonym for LENGTH()
59
=================== ====================================================================================================
62
String modificaion functions
63
----------------------------
64
=================== ====================================================================================================
66
=================== ====================================================================================================
67
CONCAT() Returns a concatenated string
68
TRIM() Remove leading and trailing spaces
69
LTRIM() Remove leading spaces
70
RTRIM() Remove trailing spaces
71
=================== ====================================================================================================
77
=================== ====================================================================================================
79
=================== ====================================================================================================
35
80
FIELD() Return the index (position) of the first argument in the sequent arguments
36
81
FIND_IN_SET() Return the index position of the first argument within the second argument
37
FORMAT() Return a number formatted to specified number of decimal places
38
HEX() Return a hexadecimal representation of a decimal or string value
39
INSERT() Insert a substring at the specified position up to the specified number of characters
40
82
INSTR() Return the index of the first occurrence of substring
41
LCASE() Synonym for LOWER()
42
83
LEFT() Return the leftmost number of characters as specified
43
LENGTH() Return the length of a string in bytes
84
INSERT() Insert a substring at the specified position up to the specified number of characters
85
LOCATE() Return the position of the first occurrence of substring
86
POSITION() A synonym for LOCATE()
87
=================== ====================================================================================================
90
Other string functions
91
----------------------
93
=================== ====================================================================================================
95
=================== ====================================================================================================
96
ELT() Return string at index number
97
EXPORT_SET() Return a string
98
FORMAT() Return a number formatted to specified number of decimal places
44
99
LOAD_FILE() Load the named file
45
LOCATE() Return the position of the first occurrence of substring
46
LOWER() Return the argument in lowercase
47
100
LPAD() Return the string argument, left-padded with the specified string
48
LTRIM() Remove leading spaces
49
101
MAKE_SET() Return a set of comma-separated strings that have the corresponding bit in bits set
50
102
MATCH Perform full-text search
51
103
MID() Return a substring starting from the specified position
52
OCTET_LENGTH() A synonym for LENGTH()
53
104
ORD() Return character code for leftmost character of the argument
54
POSITION() A synonym for LOCATE()
55
105
QUOTE() Escape the argument for use in an SQL statement
56
106
REPEAT() Repeat a string the specified number of times
57
107
REPLACE() Replace occurrences of a specified string
58
108
REVERSE() Reverse the characters in a string
59
109
RIGHT() Return the specified rightmost number of characters
60
110
RPAD() Append string the specified number of times
61
RTRIM() Remove trailing spaces
62
111
SOUNDEX() Return a soundex string
63
112
SOUNDS LIKE Compare sounds
64
113
SPACE() Return a string of the specified number of spaces
65
114
SUBSTR() Return the substring as specified
66
115
SUBSTRING_INDEX() Return a substring from a string before the specified number of occurrences of the delimiter
67
116
SUBSTRING() Return the substring as specified
68
TRIM() Remove leading and trailing spaces
69
UCASE() Synonym for UPPER()
70
UNHEX() Convert each pair of hexadecimal digits to a character
71
UPPER() Convert to uppercase
72
=================== =============================================================================================================
117
=================== ====================================================================================================