split_part
Descriptionβ
This function splits a given string according to the separators and returns the requested part. (start counting from the beginning)
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("abca", "a", 1);
+----------------------------+
| split_part('abca', 'a', 1) |
+----------------------------+
| |
+----------------------------+
keywordβ
SPLIT_PART,SPLIT,PART