1994.4.59
by Marisa Plumb
new string function docs |
1 |
Other String Functions
|
2 |
======================
|
|
3 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
4 |
.. _coercibility-function: |
5 |
||
6 |
COERCIBILITY
|
|
1994.4.64
by Marisa Plumb
more string |
7 |
------------
|
8 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
9 |
Gets coercibility for an expression. |
10 |
||
11 |
.. _elt-function: |
|
12 |
||
13 |
ELT
|
|
14 |
---
|
|
15 |
||
16 |
Return string at index number. |
|
17 |
||
18 |
.. _export-set-function: |
|
19 |
||
20 |
EXPORT_SET
|
|
21 |
----------
|
|
22 |
||
1994.4.64
by Marisa Plumb
more string |
23 |
Return a string |
24 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
25 |
.. _format-function: |
26 |
||
27 |
FORMAT
|
|
28 |
------
|
|
29 |
||
30 |
Return a number formatted to specified number of decimal places. |
|
31 |
||
32 |
.. _load-file-function: |
|
33 |
||
34 |
LOAD_FILE
|
|
1994.4.64
by Marisa Plumb
more string |
35 |
---------
|
36 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
37 |
Load the named file. |
38 |
||
39 |
.. _lpad-function: |
|
40 |
||
41 |
LPAD
|
|
42 |
----
|
|
43 |
||
44 |
Return the string argument, left-padded with the specified string. |
|
45 |
||
46 |
.. _make-set-function: |
|
47 |
||
48 |
MAKE_SET
|
|
49 |
--------
|
|
50 |
||
51 |
Return a set of comma-separated strings that have the corresponding bit in bits set. |
|
52 |
||
53 |
.. _match-function: |
|
54 |
||
55 |
MATCH
|
|
56 |
-----
|
|
57 |
||
58 |
Perform full-text search. |
|
59 |
||
60 |
.. _mid-function: |
|
61 |
||
62 |
MID
|
|
63 |
---
|
|
64 |
||
65 |
Return a substring starting from the specified position. |
|
66 |
||
67 |
.. _quote-function: |
|
68 |
||
69 |
QUOTE
|
|
70 |
-----
|
|
71 |
||
72 |
Escape the argument for use in an SQL statement. |
|
73 |
||
74 |
.. _repeat-function: |
|
75 |
||
76 |
REPEAT
|
|
77 |
------
|
|
78 |
||
79 |
Repeat a string the specified number of times. |
|
80 |
||
81 |
.. _replace-function: |
|
82 |
||
83 |
REPLACE
|
|
84 |
-------
|
|
85 |
||
1994.4.65
by Marisa Plumb
strings! |
86 |
The REPLACE() function returns a string with all occurrences of the 'from_str' replaced by 'to_str'. REPLACE is case-sensitive when searching for 'from_str'. |
87 |
||
88 |
Syntax: |
|
89 |
||
90 |
REPLACE(str,from_str,to_str) |
|
91 |
||
2194.5.2
by Andrew Hutchings
Fix SQL markup |
92 |
For example: |
93 |
||
94 |
.. code-block:: mysql |
|
1994.4.65
by Marisa Plumb
strings! |
95 |
|
96 |
SELECT REPLACE('wwww.google.com', 'w', 'v'); |
|
97 |
||
98 |
Returns: vvv.google.com |
|
1994.4.64
by Marisa Plumb
more string |
99 |
|
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
100 |
.. _reverse-function: |
101 |
||
102 |
REVERSE
|
|
103 |
-------
|
|
1994.4.64
by Marisa Plumb
more string |
104 |
|
2194.5.2
by Andrew Hutchings
Fix SQL markup |
105 |
This function returns a string argument with the characters in reverse order. |
106 |
||
107 |
.. code-block:: mysql |
|
1994.4.65
by Marisa Plumb
strings! |
108 |
|
109 |
SELECT REVERSE('abcd'); |
|
110 |
||
111 |
Returns: dcba |
|
1994.4.64
by Marisa Plumb
more string |
112 |
|
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
113 |
.. _right-function: |
114 |
||
115 |
RIGHT
|
|
116 |
-----
|
|
1994.4.64
by Marisa Plumb
more string |
117 |
|
118 |
Return the specified rightmost number of characters |
|
119 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
120 |
.. _rpad-function: |
121 |
||
122 |
RPAD
|
|
123 |
----
|
|
1994.4.64
by Marisa Plumb
more string |
124 |
|
125 |
Append string the specified number of times |
|
126 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
127 |
.. _soundex-function: |
128 |
||
129 |
SOUNDEX
|
|
130 |
-------
|
|
1994.4.64
by Marisa Plumb
more string |
131 |
|
132 |
Return a soundex string |
|
133 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
134 |
.. _substr-function: |
135 |
||
136 |
SUBSTR
|
|
137 |
------
|
|
138 |
||
139 |
Synonym for SUBSTRING(). |
|
140 |
||
141 |
.. _substring-function: |
|
142 |
||
143 |
SUBSTRING
|
|
144 |
---------
|
|
1994.4.64
by Marisa Plumb
more string |
145 |
|
146 |
Returns the substring as specified |
|
147 |
||
148 |
Examples that use SUBSTRING() in the SELECT clause: |
|
149 |
||
2194.5.2
by Andrew Hutchings
Fix SQL markup |
150 |
The SUBSTRING() function is used to extract a character string (using a given starting position and a given length). |
151 |
||
152 |
.. code-block:: mysql |
|
1994.4.64
by Marisa Plumb
more string |
153 |
|
154 |
SELECT |
|
155 |
SUBSTRING(course_designater,6,3) as 'Course number' |
|
156 |
FROM Courses |
|
157 |
WHERE course_designater LIKE 'Excel%' |
|
158 |
LIMIT 10; |
|
159 |
||
2194.5.2
by Andrew Hutchings
Fix SQL markup |
160 |
You can also format a column using SUBSTRING() in combination with functions like LOWER() and UPPER(). |
161 |
||
162 |
.. code-block:: mysql |
|
1994.4.64
by Marisa Plumb
more string |
163 |
|
164 |
SELECT
|
|
165 |
CONCAT(UPPER(SUBSTRING(lastname,1,1)), |
|
166 |
LOWER(SUBSTRING(lastname,2,29))) |
|
167 |
FROM Students |
|
168 |
LIMIT 10; |
|
169 |
||
2397.1.1
by Daniel Nichter
Skeleton documentation for all plugins, more complete docu for first half of plugins. |
170 |
.. _substring-index-function: |
171 |
||
172 |
||
173 |
SUBSTRING_INDEX
|
|
174 |
---------------
|
|
175 |
||
176 |
Return a substring from a string before the specified number of occurrences of the delimiter. |