Jump to: navigation, search

PostgreSQL SPLIT PART

From w3cyberlearnings

Contents

Postgresql split_part

Split string into fields based on the delimiter.

Syntax split_part

  • string: is a string input
  • delimiter: is a string delimiter to split
  • field: is the return field.
split_part(string,delimiter,field)

Example 1

test2=# SELECT split_part('great::good::lovely::mother','::',2);
 split_part 
------------
 good
(1 row)

Example 2

test2=# SELECT split_part('p--g--c','--',1);
 split_part 
------------
 p
(1 row)


Related Links


Navigation
Web
SQL
MISC
References