Product Solutions Support
Try MemSQL

SUBSTRING_INDEX

Extracts the portion of a string up to the given number of occurrences of a delimiter. This is mainly useful for delimited strings, eg a CSV or ascii table.

SUBSTRING_INDEX(str, delimiter, count)

Arguments

Return Type

String

Examples

memsql> select substring_index('a b c d', ' ', 3);
+------------------------------------+
| substring_index('a b c d', ' ', 3) |
+------------------------------------+
| a b c                              |
+------------------------------------+

memsql> select substring_index('de305d54-75b4-431b-adb2-eb6b9e546013', '-', 2) as uuid;
+---------------+
| uuid          |
+---------------+
| de305d54-75b4 |
+---------------+
Was this article useful?