Files
doris/docs/en/sql-reference/sql-functions/string-functions/split_part.md

2.0 KiB

title, language
title language
split_part en

split_part

Description

Syntax

'VARCHAR split party (VARCHAR content, VARCHAR delimiter, INT field)'

Returns the specified partition (counting from the beginning) by splitting the string according to the partitioner.

example

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("2019年7月8号", "月", 1);
+-----------------------------------------+
| split_part('2019年7月8号', '月', 1)     |
+-----------------------------------------+
| 2019年7                                 |
+-----------------------------------------+

mysql> select split_part("abca", "a", 1);
+----------------------------+
| split_part('abca', 'a', 1) |
+----------------------------+
|                            |
+----------------------------+

##keyword SPLIT_PART,SPLIT,PART