PostgreSQL SPLIT_PART() function
SPLIT_PART() function
The PostgreSQL split_part function is used to split a given string based on a delimiter and pick out the desired field from the string, start from the left of the string.
Syntax:
split_part(<string>,<delimiter>, <field_number>)
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL SPLIT_PART() function
Example: PostgreSQL SPLIT_PART() function :
In the example below, the delimiter of the defined string is '-#-' and specified field number is 2. So the split_part function splits the second field from the specified string.
SELECT split_part('ordno-#-orddt-#-ordamt', '-#-', 2);
Sample Output:
split_part ------------ orddt (1 row)
Previous: RTRIM function
Next: STRPOS function
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework