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

  1. mysql> select split_part("hello world", " ", 1);
  2. +----------------------------------+
  3. | split_part('hello world', ' ', 1) |
  4. +----------------------------------+
  5. | hello |
  6. +----------------------------------+
  7. mysql> select split_part("hello world", " ", 2);
  8. +----------------------------------+
  9. | split_part('hello world', ' ', 2) |
  10. +----------------------------------+
  11. | world |
  12. +----------------------------------+
  13. mysql> select split_part("2019年7月8号", "月", 1);
  14. +-----------------------------------------+
  15. | split_part('2019年7月8号', '月', 1) |
  16. +-----------------------------------------+
  17. | 20197 |
  18. +-----------------------------------------+
  19. mysql> select split_part("abca", "a", 1);
  20. +----------------------------+
  21. | split_part('abca', 'a', 1) |
  22. +----------------------------+
  23. | |
  24. +----------------------------+

keyword

SPLIT_PART,SPLIT,PART