How to use the MySQL split function?
In MySQL, the SUBSTRING function is used to extract a substring from a string. Its basic syntax is as follows:
SUBSTRING(str, start, length)
Among them:
- “str is the original string from which the substring will be extracted.”
- The start parameter is the position from which to extract the substring (starting from 1).
- Length is the length of the substring to be extracted.
For example, to extract 5 characters starting from the 3rd character in a string, you can use the following query:
SELECT SUBSTRING('Hello World', 3, 5);
This will return llo W.