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. (hello world','1)'124split part';
  4. +----------------------------------+
  5. | hello |
  6. +----------------------------------+
  7. mysql> select split_part("hello world", " ", 2);
  8. +----------------------------------+
  9. (hello world','2)'124u;
  10. +----------------------------------+
  11. | world |
  12. +----------------------------------+
  13. mysql> select split_part("2019年7月8号", "月", 1);
  14. +-----------------------------------------+
  15. (2019726376;821495;','263761,') 1244;
  16. +-----------------------------------------+
  17. | July 2019|
  18. +-----------------------------------------+
  19. mysql> select split_part("abca", "a", 1);
  20. +----------------------------+
  21. split part ('abca','a', 1)
  22. +----------------------------+
  23. | |
  24. +----------------------------+

keyword SPLIT_PART,SPLIT,PART