split_part
この関数は、指定された文字列をセパレーターに従って分割し、要求された部分を返します。(最初から数え始めます)
Syntax
VARCHAR split_part(VARCHAR content, VARCHAR delimiter, INT field)
Examples
MySQL > select split_part("hello world", " ", 1);
+----------------------------------+
|split_part('hello world', ' ', 1) |
+----------------------------------+
| hello |
+----------------------------------+
MySQL > select split_part("hello world", " ", 2);
+-----------------------------------+
| split_part('hello world', ' ', 2) |
+-----------------------------------+
| world |
+-----------------------------------+
MySQL > select split_part("hello world", " ", -1);
+----------------------------------+
|split_part('hello world', ' ', -1) |
+----------------------------------+
| world |
+----------------------------------+
MySQL > select split_part("hello world", " ", -2);
+-----------------------------------+
| split_part('hello world', ' ', -2) |
+-----------------------------------+
| hello |
+-----------------------------------+
MySQL > select split_part("abca", "a", 1);
+----------------------------+
| split_part('abca', 'a', 1) |
+----------------------------+
| |
+----------------------------+
select split_part("abca", "a", -1);
+-----------------------------+
| split_part('abca', 'a', -1) |
+-----------------------------+
| |
+-----------------------------+
select split_part("abca", "a", -2);
+-----------------------------+
| split_part('abca', 'a', -2) |
+-----------------------------+
| bc |
+-----------------------------+
keyword
SPLIT_PART,SPLIT,PART